includes/pageutils.php
changeset 609 ffa5decbb305
parent 593 4f9bec0d65c1
child 621 68f8a9cc0a18
--- a/includes/pageutils.php	Mon Jul 07 18:13:01 2008 -0400
+++ b/includes/pageutils.php	Wed Jul 09 13:18:25 2008 -0400
@@ -1124,6 +1124,7 @@
   {
     global $db, $session, $paths, $template, $plugins; // Common objects
     global $lang;
+    global $cache;
     $perms = $session->fetch_page_acl($page_id, $namespace);
     $x = trim($reason);
     if ( empty($x) )
@@ -1141,8 +1142,12 @@
     if(!$e) $db->_die('The page text entry could not be deleted.');
     $e = $db->sql_query('DELETE FROM ' . table_prefix.'pages WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
     if(!$e) $db->_die('The page entry could not be deleted.');
-    $e = $db->sql_query('DELETE FROM ' . table_prefix.'files WHERE page_id=\'' . $page_id . '\'');
-    if(!$e) $db->_die('The file entry could not be deleted.');
+    if ( $namespace == 'File' )
+    {
+      $e = $db->sql_query('DELETE FROM ' . table_prefix.'files WHERE page_id=\'' . $page_id . '\'');
+      if(!$e) $db->_die('The file entry could not be deleted.');
+    }
+    $cache->purge('page_meta');
     return $lang->get('ajax_delete_success');
   }