Fixed some rather severe issues when changing the urlname of uploaded files
authorDan Fuhry <dan@enanocms.org>
Thu, 18 Nov 2010 15:34:30 -0500
changeset 1325 1e20add419c8
parent 1324 612680c02316
child 1326 f99dfb1b0530
Fixed some rather severe issues when changing the urlname of uploaded files
plugins/admin/PageManager.php
--- a/plugins/admin/PageManager.php	Thu Nov 18 15:34:06 2010 -0500
+++ b/plugins/admin/PageManager.php	Thu Nov 18 15:34:30 2010 -0500
@@ -248,6 +248,7 @@
 											'UPDATE ' . table_prefix . "comments SET page_id = '$page_id_new', namespace = '$namespace_new' WHERE page_id = '$page_id_db' AND namespace = '$namespace_db';",
 											'UPDATE ' . table_prefix . "page_text SET page_id = '$page_id_new', namespace = '$namespace_new' WHERE page_id = '$page_id_db' AND namespace = '$namespace_db';",
 											'UPDATE ' . table_prefix . "categories SET page_id = '$page_id_new', namespace = '$namespace_new' WHERE page_id = '$page_id_db' AND namespace = '$namespace_db';"
+											'UPDATE ' . table_prefix . "files SET page_id = '$page_id_new', filename = '$page_id_new' WHERE page_id = '$page_id_db';"
 										);
 									foreach ( $sql as $q )
 									{
@@ -256,7 +257,7 @@
 									}
 									
 									// If we're going File -> other, remove files
-									if ( $namespace_db === 'File' )
+									if ( $namespace_db === 'File' && $namespace_new !== 'File' )
 									{
 										PageUtils::delete_page_files($page_id);
 									}