Fixed a few places where page metadata cache should have been purged (there may be a few more commits like this)
authorDan
Wed, 09 Jul 2008 13:18:25 -0400
changeset 609 ffa5decbb305
parent 608 ec9385bb7243
child 610 de33b0d26741
Fixed a few places where page metadata cache should have been purged (there may be a few more commits like this)
includes/pageutils.php
plugins/SpecialUpdownload.php
--- 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');
   }
   
--- a/plugins/SpecialUpdownload.php	Mon Jul 07 18:13:01 2008 -0400
+++ b/plugins/SpecialUpdownload.php	Wed Jul 09 13:18:25 2008 -0400
@@ -49,6 +49,7 @@
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
   global $lang;
+  global $cache;
   global $mime_types;
   if(getConfig('enable_uploads')!='1') { die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('upload_err_disabled_site') . '</p>'); }
   if ( !$session->get_permissions('upload_files') )
@@ -148,6 +149,7 @@
     {
       if(!$db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,author,page_id,namespace,edit_summary) VALUES('.$utime.', \''.enano_date('d M Y h:i a').'\', \'page\', \'reupload\', \''.$session->username.'\', \''.$filename.'\', \''.'File'.'\', \''.$comments.'\');')) $db->_die('The page log could not be updated.');
     }
+    $cache->purge('page_meta');
     die_friendly($lang->get('upload_success_title'), '<p>' . $lang->get('upload_success_body', array('file_link' => makeUrlNS('File', $filename))) . '</p>');
   }
   else