From 15cd86a80fa4c5a8deeee45e39f8f90dbfe04dfa Mon Sep 17 00:00:00 2001 From: mikelittle Date: Wed, 18 Jun 2003 01:55:53 +0000 Subject: [PATCH] table changes. git-svn-id: http://svn.automattic.com/wordpress/trunk@235 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/upgrade-071-to-072.php | 41 +++++++++++++++++++++++++-------- wp-admin/wp-install.php | 6 +++-- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/wp-admin/upgrade-071-to-072.php b/wp-admin/upgrade-071-to-072.php index cd7b87d8e5..8ebc7fa240 100644 --- a/wp-admin/upgrade-071-to-072.php +++ b/wp-admin/upgrade-071-to-072.php @@ -80,16 +80,16 @@ switch($step) { $query = " CREATE TABLE $tableoptions ( option_id int(11) NOT NULL auto_increment, - blog_id int(11) not null default 0, + blog_id int(11) NOT NULL default 0, + option_name varchar(64) NOT NULL default '', option_can_override enum ('Y','N') NOT NULL default 'Y', - option_name varchar(64) UNIQUE NOT NULL default '', option_type int(11) NOT NULL default 1, option_value varchar(255) NOT NULL default '', option_width int NOT NULL default 20, option_height int NOT NULL default 8, option_description tinytext NOT NULL default '', option_admin_level int NOT NULL DEFAULT '1', - PRIMARY KEY (option_id, blog_id) + PRIMARY KEY (option_id, blog_id, option_name) ) "; $q = $wpdb->query($query); @@ -401,17 +401,40 @@ foreach ($option_data as $query) { // now pickup the old settings table data $v = $wpdb->get_var("SELECT posts_per_page from $tablesettings"); - $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=48"; $q = $wpdb->query($query); + if ($v != null) { + $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=48"; + $q = $wpdb->query($query); + } + $v = $wpdb->get_var("SELECT what_to_show from $tablesettings"); - $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=49"; $q = $wpdb->query($query); + if ($v != null) { + $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=49"; + $q = $wpdb->query($query); + } + $v = $wpdb->get_var("SELECT archive_mode from $tablesettings"); - $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=50"; $q = $wpdb->query($query); + if ($v != null) { + $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=50"; + $q = $wpdb->query($query); + } + $v = $wpdb->get_var("SELECT time_difference from $tablesettings"); - $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=51"; $q = $wpdb->query($query); + if ($v != null) { + $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=51"; + $q = $wpdb->query($query); + } + $v = $wpdb->get_var("SELECT date_format from $tablesettings"); - $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=52"; $q = $wpdb->query($query); + if ($v != null) { + $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=52"; + $q = $wpdb->query($query); + } + $v = $wpdb->get_var("SELECT time_format from $tablesettings"); - $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=53"; $q = $wpdb->query($query); + if ($v != null) { + $query = "UPDATE $tableoptions SET option_value='".addslashes($v)."' WHERE option_id=53"; + $q = $wpdb->query($query); + } // ok it can go now $query = "DROP TABLE $tablesettings"; diff --git a/wp-admin/wp-install.php b/wp-admin/wp-install.php index 11262cb3cd..9b15b448a6 100644 --- a/wp-admin/wp-install.php +++ b/wp-admin/wp-install.php @@ -259,14 +259,16 @@ $q = $wpdb->query($query); $query = " CREATE TABLE $tableoptions ( option_id int(11) NOT NULL auto_increment, - option_name varchar(64) UNIQUE NOT NULL default '', + blog_id int(11) NOT NULL default 0, + option_name varchar(64) NOT NULL default '', + option_can_override enum ('Y','N') NOT NULL default 'Y', option_type int(11) NOT NULL default 1, option_value varchar(255) NOT NULL default '', option_width int NOT NULL default 20, option_height int NOT NULL default 8, option_description tinytext NOT NULL default '', option_admin_level int NOT NULL DEFAULT '1', - PRIMARY KEY (option_id) + PRIMARY KEY (option_id, blog_id, option_name) ) "; $q = $wpdb->query($query);