includes/pageutils.php
changeset 609 ffa5decbb305
parent 593 4f9bec0d65c1
child 621 68f8a9cc0a18
equal deleted inserted replaced
608:ec9385bb7243 609:ffa5decbb305
  1122    
  1122    
  1123   public static function deletepage($page_id, $namespace, $reason)
  1123   public static function deletepage($page_id, $namespace, $reason)
  1124   {
  1124   {
  1125     global $db, $session, $paths, $template, $plugins; // Common objects
  1125     global $db, $session, $paths, $template, $plugins; // Common objects
  1126     global $lang;
  1126     global $lang;
       
  1127     global $cache;
  1127     $perms = $session->fetch_page_acl($page_id, $namespace);
  1128     $perms = $session->fetch_page_acl($page_id, $namespace);
  1128     $x = trim($reason);
  1129     $x = trim($reason);
  1129     if ( empty($x) )
  1130     if ( empty($x) )
  1130     {
  1131     {
  1131       return $lang->get('ajax_delete_need_reason');
  1132       return $lang->get('ajax_delete_need_reason');
  1139     if(!$e) $db->_die('The page comments could not be deleted.');
  1140     if(!$e) $db->_die('The page comments could not be deleted.');
  1140     $e = $db->sql_query('DELETE FROM ' . table_prefix.'page_text WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1141     $e = $db->sql_query('DELETE FROM ' . table_prefix.'page_text WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1141     if(!$e) $db->_die('The page text entry could not be deleted.');
  1142     if(!$e) $db->_die('The page text entry could not be deleted.');
  1142     $e = $db->sql_query('DELETE FROM ' . table_prefix.'pages WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1143     $e = $db->sql_query('DELETE FROM ' . table_prefix.'pages WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\'');
  1143     if(!$e) $db->_die('The page entry could not be deleted.');
  1144     if(!$e) $db->_die('The page entry could not be deleted.');
  1144     $e = $db->sql_query('DELETE FROM ' . table_prefix.'files WHERE page_id=\'' . $page_id . '\'');
  1145     if ( $namespace == 'File' )
  1145     if(!$e) $db->_die('The file entry could not be deleted.');
  1146     {
       
  1147       $e = $db->sql_query('DELETE FROM ' . table_prefix.'files WHERE page_id=\'' . $page_id . '\'');
       
  1148       if(!$e) $db->_die('The file entry could not be deleted.');
       
  1149     }
       
  1150     $cache->purge('page_meta');
  1146     return $lang->get('ajax_delete_success');
  1151     return $lang->get('ajax_delete_success');
  1147   }
  1152   }
  1148   
  1153   
  1149   /**
  1154   /**
  1150    * Increments the deletion votes for a page by 1, and adds the current username/IP to the list of users that have voted for the page to prevent dual-voting
  1155    * Increments the deletion votes for a page by 1, and adds the current username/IP to the list of users that have voted for the page to prevent dual-voting