File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 125125 <step id =" 1240" >UPDATE %PREFIX%_categories SET cat_type = 'EVT' WHERE cat_type = 'DAT'</step >
126126 <step id =" 1250" >UPDATE %PREFIX%_categories SET cat_org_id = 1 WHERE cat_org_id IS NULL AND cat_name_intern = 'EVENTS'</step >
127127 <step id =" 1255" >UPDATE %PREFIX%_roles_rights SET ror_table = '%PREFIX%_events' WHERE ror_table = '%PREFIX%_dates'</step >
128+ <step id =" 1260" >ComponentUpdateSteps::updateStep43RepairDocumentsPath</step >
128129 <step >stop</step >
129130</update >
Original file line number Diff line number Diff line change @@ -28,6 +28,31 @@ public static function setDatabase(Database $database)
2828 self ::$ db = $ database ;
2929 }
3030
31+ /**
32+ * Repair the path of the folders
33+ */
34+ public static function updateStep43RepairDocumentsPath ()
35+ {
36+ $ sql = 'SELECT fol_id, fol_name, fol_path
37+ FROM ' . TBL_FOLDERS . '
38+ WHERE fol_fol_id_parent IS NULL ' ;
39+ $ rootFolderStatement = self ::$ db ->queryPrepared ($ sql );
40+
41+ while ($ rowRootFolder = $ rootFolderStatement ->fetch ()) {
42+ $ rootFolder = new TableFolder (self ::$ db , $ rowRootFolder ['fol_id ' ]);
43+
44+ $ sql = 'SELECT fol_id, fol_name, fol_path
45+ FROM ' . TBL_FOLDERS . '
46+ WHERE fol_fol_id_parent = ? -- $rowRootFolder[ \'fol_id \'] ' ;
47+ $ folderStatement = self ::$ db ->queryPrepared ($ sql , array ($ rowRootFolder ['fol_id ' ]));
48+
49+ while ($ row = $ folderStatement ->fetch ()) {
50+ $ folder = new TableFolder (self ::$ db , $ row ['fol_id ' ]);
51+ $ folder ->rename ($ row ['fol_name ' ], $ rootFolder ->getValue ('fol_path ' ) . '/ ' . $ rowRootFolder ['fol_name ' ]);
52+ }
53+ }
54+ }
55+
3156 /**
3257 * This method removes wrong configured visible roles of category Basic_Data
3358 */
Original file line number Diff line number Diff line change @@ -682,6 +682,9 @@ public function moveToFolder(string $destFolderUUID)
682682 $ this ->setValue ('fol_locked ' , $ folder ->getValue ('fol_locked ' ));
683683 $ this ->save ();
684684
685+ // set new path to all subfolders
686+ $ this ->rename ($ this ->getValue ('fol_name ' ), $ folder ->getValue ('fol_path ' ) . '/ ' . $ folder ->getValue ('fol_name ' ));
687+
685688 // adopt the role rights of the new parent folder
686689 $ this ->removeRolesOnFolder ('folder_view ' , $ this ->getViewRolesIds ());
687690 $ this ->removeRolesOnFolder ('folder_upload ' , $ this ->getUploadRolesIds ());
You can’t perform that action at this time.
0 commit comments