Deprecate option_can_override, option_type, option_width, option_height, option_description, option_admin_level from options table. Props Nazgul. fixes #4390

git-svn-id: http://svn.automattic.com/wordpress/trunk@6039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-09-05 19:20:53 +00:00
parent c8215773ce
commit 98a92950a3
5 changed files with 18 additions and 15 deletions

View File

@ -77,13 +77,7 @@ CREATE TABLE $wpdb->options (
option_id bigint(20) NOT NULL auto_increment,
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 longtext NOT NULL,
option_width int(11) NOT NULL default '20',
option_height int(11) NOT NULL default '8',
option_description tinytext NOT NULL,
option_admin_level int(11) NOT NULL default '1',
autoload enum('yes','no') NOT NULL default 'yes',
PRIMARY KEY (option_id,blog_id,option_name),
KEY option_name (option_name)
@ -155,9 +149,9 @@ function populate_options() {
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
add_option('siteurl', $guessurl, __('WordPress web address'));
add_option('blogname', __('My Blog'), __('Blog title'));
add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
add_option('siteurl', $guessurl);
add_option('blogname', __('My Blog'));
add_option('blogdescription', __('Just another WordPress weblog'));
add_option('new_users_can_blog', 0);
add_option('users_can_register', 0);
add_option('admin_email', 'you@example.com');
@ -203,7 +197,7 @@ function populate_options() {
add_option('comment_max_links', 2);
add_option('gmt_offset', date('Z') / 3600);
// 1.5
add_option('default_email_category', 1, __('Posts by email go to this category'));
add_option('default_email_category', 1);
add_option('recently_edited');
add_option('use_linksupdate', 0);
add_option('template', 'default');

View File

@ -191,6 +191,8 @@ function upgrade_all() {
if ( $wp_current_db_version < 5539 )
upgrade_230();
if ( $wp_current_db_version < 6039 )
upgrade_230_options_table();
maybe_disable_automattic_widgets();
@ -678,6 +680,15 @@ function upgrade_230() {
}
}
function upgrade_230_options_table() {
global $wpdb;
$old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
$wpdb->hide_errors();
foreach ( $old_options_fields as $old )
$wpdb->query("ALTER TABLE $wpdb->options DROP $old");
$wpdb->show_errors();
}
function upgrade_old_slugs() {
// upgrade people who were using the Redirect Old Slugs plugin
global $wpdb;

View File

@ -82,7 +82,6 @@ foreach ( (array) $options as $option) :
else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . attribute_escape($value) . "'$disabled />";
echo "</td>
<td>$option->option_description</td>
</tr>";
endforeach;
?>

View File

@ -329,7 +329,7 @@ function update_option($option_name, $newvalue) {
// thx Alex Stapleton, http://alex.vort-x.net/blog/
// expects $name to NOT be SQL-escaped
function add_option($name, $value = '', $description = '', $autoload = 'yes') {
function add_option($name, $value = '', $deprecated = '', $autoload = 'yes') {
global $wpdb;
wp_protect_special_option($name);
@ -361,8 +361,7 @@ function add_option($name, $value = '', $description = '', $autoload = 'yes') {
$name = $wpdb->escape($name);
$value = $wpdb->escape($value);
$description = $wpdb->escape($description);
$wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, option_description, autoload) VALUES ('$name', '$value', '$description', '$autoload')");
$wpdb->query("INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES ('$name', '$value', '$autoload')");
return;
}

View File

@ -3,6 +3,6 @@
// This holds the version number in a separate file so we can bump it without cluttering the SVN
$wp_version = '2.3-beta2';
$wp_db_version = 5540;
$wp_db_version = 6039;
?>