Commit 72442042a29b0aab90503c9ad6eb58cff86859c0
1 parent
6c328925
Fixed function removeSlashesFromFolers to include the document title when updati…
…ng the document full_path Committed By: Keivn Cyster Reviewed By: Megan Watson
Showing
1 changed file
with
13 additions
and
3 deletions
lib/upgrades/UpgradeFunctions.inc.php
| ... | ... | @@ -322,10 +322,20 @@ class UpgradeFunctions { |
| 322 | 322 | $sql = "update folders set name=?,description=?, full_path=?, parent_folder_ids=? where id=?"; |
| 323 | 323 | DBUtil::runQuery(array($sql, array($name,$name, $full_path, $parent_ids, $folderid))); |
| 324 | 324 | |
| 325 | - // update documents | |
| 326 | - $sql = "update documents set full_path=?, parent_folder_ids=? where folder_id=?"; | |
| 327 | - DBUtil::runQuery(array($sql, array($full_path, $parent_ids, $folderid))); | |
| 325 | + $sql = "Select id, metadata_version_id from documents where folder_id=$folderid"; | |
| 326 | + $documents = DBUtil::getResultArray($sql); | |
| 328 | 327 | |
| 328 | + foreach($documents as $document){ | |
| 329 | + $dId = $document['id']; | |
| 330 | + $mId = $document['metadata_version_id']; | |
| 331 | + | |
| 332 | + $sql = "Select name from document_metadata_version where id=$mId"; | |
| 333 | + $title = DBUtil::getOneResultKey($sql, 'name'); | |
| 334 | + | |
| 335 | + // update documents | |
| 336 | + $sql = "update documents set full_path=CONCAT_WS('/',?,'$title'), parent_folder_ids=? where id=?"; | |
| 337 | + DBUtil::runQuery(array($sql, array($full_path, $parent_ids, $dId))); | |
| 338 | + } | |
| 329 | 339 | |
| 330 | 340 | // recurse subfolders |
| 331 | 341 | foreach($ids as $row) | ... | ... |