Remove optiontypes table.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-09-04 22:04:19 +00:00
parent 5e87dfc5df
commit 7e1cc4c8c0
3 changed files with 2 additions and 55 deletions

View File

@ -342,22 +342,6 @@ CREATE TABLE $wpdb->options (
"; ";
$q = $wpdb->query($query); $q = $wpdb->query($query);
// $query = "DROP TABLE IF EXISTS $tableoptiontypes";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptiontypes\" in the database.");
$query = "
CREATE TABLE $wpdb->optiontypes (
optiontype_id int(11) NOT NULL auto_increment,
optiontype_name varchar(64) NOT NULL,
PRIMARY KEY (optiontype_id)
)
";
$q = $wpdb->query($query);
// $query = "DROP TABLE IF EXISTS $tableoptiongroups";
// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$tableoptiongroups\" in the database.");
$query = " $query = "
CREATE TABLE $wpdb->optiongroups ( CREATE TABLE $wpdb->optiongroups (
group_id int(11) NOT NULL auto_increment, group_id int(11) NOT NULL auto_increment,
@ -384,15 +368,6 @@ CREATE TABLE $wpdb->optiongroup_options (
$q = $wpdb->query($query); $q = $wpdb->query($query);
$option_data = array( $option_data = array(
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (1, 'integer')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (2, 'boolean')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (3, 'string')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (4, 'date')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (5, 'select')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (6, 'range')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (7, 'sqlselect')",
"INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES (8, 'float')",
//base options from b2cofig //base options from b2cofig
"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, '$guessurl', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(1,'siteurl', 3, '$guessurl', 'siteurl is your blog\'s URL: for example, \'http://example.com/wordpress\' (no trailing slash !)', 8, 30)",
"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)", "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(2,'blogfilename', 3, 'index.php', 'blogfilename is the name of the default file for your blog', 8, 20)",

View File

@ -92,11 +92,6 @@ CREATE TABLE $wpdb->options (
autoload enum('yes','no') NOT NULL default 'yes', autoload enum('yes','no') NOT NULL default 'yes',
PRIMARY KEY (option_id,blog_id,option_name) PRIMARY KEY (option_id,blog_id,option_name)
); );
CREATE TABLE $wpdb->optiontypes (
optiontype_id int(11) NOT NULL auto_increment,
optiontype_name varchar(64) NOT NULL default '',
PRIMARY KEY (optiontype_id)
);
CREATE TABLE $wpdb->post2cat ( CREATE TABLE $wpdb->post2cat (
rel_id int(11) NOT NULL auto_increment, rel_id int(11) NOT NULL auto_increment,
post_id int(11) NOT NULL default '0', post_id int(11) NOT NULL default '0',
@ -222,13 +217,6 @@ function upgrade_072() {
PRIMARY KEY (option_id, blog_id, option_name) PRIMARY KEY (option_id, blog_id, option_name)
) )
"); ");
maybe_create_table($wpdb->optiontypes, "
CREATE TABLE $wpdb->optiontypes (
optiontype_id int(11) NOT NULL auto_increment,
optiontype_name varchar(64) NOT NULL,
PRIMARY KEY (optiontype_id)
)
");
maybe_create_table($wpdb->optiongroups, " maybe_create_table($wpdb->optiongroups, "
CREATE TABLE $wpdb->optiongroups ( CREATE TABLE $wpdb->optiongroups (
group_id int(11) NOT NULL auto_increment, group_id int(11) NOT NULL auto_increment,
@ -246,22 +234,6 @@ function upgrade_072() {
PRIMARY KEY (group_id, option_id) PRIMARY KEY (group_id, option_id)
) )
"); ");
// TODO: REWRITE THIS
$option_types = array(
"1" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('1', 'integer')",
"2" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('2', 'boolean')",
"3" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('3', 'string')",
"4" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('4', 'date')",
"5" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('5', 'select')",
"6" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('6', 'range')",
"7" => "INSERT INTO $wpdb->optiontypes (optiontype_id, optiontype_name) VALUES ('7', 'sqlselect')");
foreach ($option_types as $option_id => $query) {
if(!$wpdb->get_var("SELECT * FROM $wpdb->optiontypes WHERE optiontype_id = '$option_id'")) {
$wpdb->query($query);
}
}
// Guess a site URI // Guess a site URI
$guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $HTTP_HOST . $REQUEST_URI); $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $HTTP_HOST . $REQUEST_URI);
@ -903,7 +875,9 @@ function upgrade_130() {
update_option('active_plugins', $plugins); update_option('active_plugins', $plugins);
} }
// Obsolete tables
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues'); $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
$wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiontypes');
} }
// The functions we use to actually do stuff // The functions we use to actually do stuff

View File

@ -25,7 +25,6 @@ $wpdb->comments = $table_prefix . 'comments';
$wpdb->links = $table_prefix . 'links'; $wpdb->links = $table_prefix . 'links';
$wpdb->linkcategories = $table_prefix . 'linkcategories'; $wpdb->linkcategories = $table_prefix . 'linkcategories';
$wpdb->options = $table_prefix . 'options'; $wpdb->options = $table_prefix . 'options';
$wpdb->optiontypes = $table_prefix . 'optiontypes';
$wpdb->optiongroups = $table_prefix . 'optiongroups'; $wpdb->optiongroups = $table_prefix . 'optiongroups';
$wpdb->optiongroup_options = $table_prefix . 'optiongroup_options'; $wpdb->optiongroup_options = $table_prefix . 'optiongroup_options';
$wpdb->postmeta = $table_prefix . 'postmeta'; $wpdb->postmeta = $table_prefix . 'postmeta';
@ -40,7 +39,6 @@ $tablecomments = $wpdb->comments;
$tablelinks = $wpdb->links; $tablelinks = $wpdb->links;
$tablelinkcategories = $wpdb->linkcategories; $tablelinkcategories = $wpdb->linkcategories;
$tableoptions = $wpdb->options; $tableoptions = $wpdb->options;
$tableoptiontypes = $wpdb->optiontypes;
$tableoptiongroups = $wpdb->optiongroups; $tableoptiongroups = $wpdb->optiongroups;
$tableoptiongroup_options = $wpdb->optiongroup_options; $tableoptiongroup_options = $wpdb->optiongroup_options;
$tablepostmeta = $wpdb->postmeta; $tablepostmeta = $wpdb->postmeta;