From 402940382bc89e2297a1919bb6f37bab562436f0 Mon Sep 17 00:00:00 2001 From: e107steved Date: Sat, 22 Sep 2007 20:32:31 +0000 Subject: [PATCH] Delete some obsolete tables --- e107_admin/sql/core_sql.php | 34 +++-------------------- e107_admin/update_routines.php | 49 ++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 54 deletions(-) diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php index 906111449..77446cc47 100644 --- a/e107_admin/sql/core_sql.php +++ b/e107_admin/sql/core_sql.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:33:33 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2007-09-22 20:32:31 $ +| $Author: e107steved $ +----------------------------------------------------------------------------+ */ header("location:../index.php"); @@ -192,34 +192,6 @@ CREATE TABLE download_requests ( ) TYPE=MyISAM; # -------------------------------------------------------- - -# -# Table structure for table `flood` -# - -CREATE TABLE flood ( - flood_url text NOT NULL, - flood_time int(10) unsigned NOT NULL default '0' -) TYPE=MyISAM; -# -------------------------------------------------------- - -# -# Table structure for table `headlines` -# - -CREATE TABLE headlines ( - headline_id int(10) unsigned NOT NULL auto_increment, - headline_url varchar(150) NOT NULL default '', - headline_data text NOT NULL, - headline_timestamp int(10) unsigned NOT NULL default '0', - headline_description text NOT NULL, - headline_image varchar(100) NOT NULL default '', - headline_active tinyint(1) unsigned NOT NULL default '0', - PRIMARY KEY (headline_id) -) TYPE=MyISAM; - -# -------------------------------------------------------- - # # Table structure for table `links` # diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index c7e70ca22..9675026d3 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ -| $Revision: 1.8 $ -| $Date: 2007-06-24 16:18:48 $ +| $Revision: 1.9 $ +| $Date: 2007-09-22 20:32:31 $ | $Author: e107steved $ +----------------------------------------------------------------------------+ */ @@ -214,6 +214,10 @@ function update_706_to_800($type='') // List of unwanted $pref values which can go $obs_prefs = array('frontpage_type'); + + // List of DB tables not required (includes a few from 0.6xx) + $obs_tables = array('flood', 'headlines', 'stat_info', 'stat_counter', 'stat_last'); + $do_save = FALSE; $just_check = $type == 'do' ? FALSE : TRUE; // TRUE if we're just seeing if an update is needed @@ -325,20 +329,16 @@ function update_706_to_800($type='') } - // Obsolete tables - if (mysql_table_exists("headlines")) + // Obsolete tables (list at top) + foreach ($obs_tables as $ot) { + if (mysql_table_exists($ot)) + { if ($just_check) return update_needed(); - mysql_query('DROP TABLE `'.MPREFIX.'headlines`'); + mysql_query('DROP TABLE `'.MPREFIX.$ot.'`'); + } } - if (mysql_table_exists("flood")) - { - if ($just_check) return update_needed(); - mysql_query('DROP TABLE `'.MPREFIX.'flood`'); - } - - if ($do_save) save_prefs(); @@ -440,20 +440,23 @@ function update_needed() return FALSE; } -function mysql_table_exists($table){ - $exists = mysql_query("SELECT 1 FROM ".MPREFIX."$table LIMIT 0"); - if ($exists) return TRUE; - return FALSE; +function mysql_table_exists($table) +{ + $exists = mysql_query("SELECT 1 FROM ".MPREFIX."$table LIMIT 0"); + if ($exists) return TRUE; + return FALSE; } -function catch_error(){ - if (mysql_error()!='' && E107_DEBUG_LEVEL != 0) { - $tmp2 = debug_backtrace(); - $tmp = mysql_error(); - echo $tmp." [ ".basename(__FILE__)." on line ".$tmp2[0]['line']."]
"; - } - return; +function catch_error() +{ + if (mysql_error()!='' && E107_DEBUG_LEVEL != 0) + { + $tmp2 = debug_backtrace(); + $tmp = mysql_error(); + echo $tmp." [ ".basename(__FILE__)." on line ".$tmp2[0]['line']."]
"; + } + return; }