From 72442042a29b0aab90503c9ad6eb58cff86859c0 Mon Sep 17 00:00:00 2001 From: Kevin Cyster Date: Fri, 27 Feb 2009 13:13:25 +0200 Subject: [PATCH] Fixed function removeSlashesFromFolers to include the document title when updating the document full_path --- lib/upgrades/UpgradeFunctions.inc.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/upgrades/UpgradeFunctions.inc.php b/lib/upgrades/UpgradeFunctions.inc.php index ad7af10..222c5a4 100644 --- a/lib/upgrades/UpgradeFunctions.inc.php +++ b/lib/upgrades/UpgradeFunctions.inc.php @@ -322,10 +322,20 @@ class UpgradeFunctions { $sql = "update folders set name=?,description=?, full_path=?, parent_folder_ids=? where id=?"; DBUtil::runQuery(array($sql, array($name,$name, $full_path, $parent_ids, $folderid))); - // update documents - $sql = "update documents set full_path=?, parent_folder_ids=? where folder_id=?"; - DBUtil::runQuery(array($sql, array($full_path, $parent_ids, $folderid))); + $sql = "Select id, metadata_version_id from documents where folder_id=$folderid"; + $documents = DBUtil::getResultArray($sql); + foreach($documents as $document){ + $dId = $document['id']; + $mId = $document['metadata_version_id']; + + $sql = "Select name from document_metadata_version where id=$mId"; + $title = DBUtil::getOneResultKey($sql, 'name'); + + // update documents + $sql = "update documents set full_path=CONCAT_WS('/',?,'$title'), parent_folder_ids=? where id=?"; + DBUtil::runQuery(array($sql, array($full_path, $parent_ids, $dId))); + } // recurse subfolders foreach($ids as $row) -- libgit2 0.21.4