Make WordPress Core

Changeset 1596


Ignore:
Timestamp:
09/04/2004 10:09:21 PM (20 years ago)
Author:
saxmatt
Message:

Remove optiongroups table.

Location:
trunk/wp-admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/install.php

    r1595 r1596  
    342342";
    343343$q = $wpdb->query($query);
    344 
    345 $query = "
    346 CREATE TABLE $wpdb->optiongroups (
    347   group_id int(11) NOT NULL auto_increment,
    348   group_name varchar(64) not null,
    349   group_desc varchar(255),
    350   group_longdesc tinytext,
    351   PRIMARY KEY (group_id)
    352 )
    353 ";
    354 $q = $wpdb->query($query);
    355 
    356 
    357 // $query = "DROP TABLE IF EXISTS $wpdb->optiongroup_options";
    358 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->optiongroup_options\" in the database.");
    359344
    360345$query = "
     
    419404
    420405//'pages' of options
    421 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(1, 'Other Options', 'Posts per page etc. Original options page')",
    422406"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,48,1 )",
    423407"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,49,2 )",
     
    427411"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(1,53,6 )",
    428412
    429 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(2, 'General blog settings', 'Things you\'ll probably want to tweak')",
    430413"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,9 ,1 )",
    431414//"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,10,2 )",
     
    441424"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(2,20,12)",
    442425
    443 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(3, 'RSS/RDF Feeds, Track/Ping-backs', 'Settings for RSS/RDF Feeds, Track/ping-backs')",
    444426"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,21,1 )",
    445427"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,22,2 )",
     
    453435"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(3,30,10)",
    454436
    455 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(4, 'File uploads', 'Settings for file uploads')",
    456437"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,31,1 )",
    457438"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,32,2 )",
     
    462443"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(4,37,7 )",
    463444
    464 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(5, 'Blog-by-Email settings', 'Settings for blogging via email')",
    465445"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,38,1 )",
    466446"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,39,2 )",
     
    474454"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(5,47,10)",
    475455
    476 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(6, 'Base settings', 'Basic settings required to get your blog working')",
    477456"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,1,1)",
    478457"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(6,2,2)",
     
    499478"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(83,'default_post_edit_rows', 1, '9', 'The number of rows in the edit post form (min 3, max 100)', 8, 5)",
    500479
    501 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(7, 'Default post options', 'Default settings for new posts.')",
    502480"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,55,1 )",
    503481"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(7,56,2 )",
     
    542520
    543521//group them together
    544 "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES(8, 'Link Manager Settings', 'Various settings for the link manager.')",
    545522"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,60,1 )",
    546523"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(8,61,2 )",
     
    582559"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(87,'default_geourl_lon', 8, 0.0, 'The default Longitude ICBM value', 8, 20)",
    583560
    584 "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES(9,'Geo Options', 'Settings which control the posting and display of Geo Options')",
    585561
    586562"INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES(9,84,1)",
  • trunk/wp-admin/options-head.php

    r1551 r1596  
    33if ($user_level <= 6) {
    44    die( __('You have do not have sufficient permissions to edit the options for this blog.') );
    5 }
    6 
    7 //we need to iterate through the available option groups.
    8 $groups = '';
    9 $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $wpdb->optiongroups ORDER BY group_id");
    10 foreach ($option_groups as $option_group) {
    11     if ($option_group->group_id == $option_group_id) {
    12         $current_desc = $option_group->group_desc;
    13         $current_long_desc = $option_group->group_longdesc;
    14         $groups .= "<li><a class='current' title='{$option_group->group_desc}'>{$option_group->group_name}</a></li>\n";
    15     } else {
    16         $groups .= "<li><a href='options.php?option_group_id={$option_group->group_id}' title='{$option_group->group_desc}'>{$option_group->group_name}</a></li>\n";
    17     }
    185}
    196?>
  • trunk/wp-admin/options.php

    r1587 r1596  
    126126?>
    127127
    128 <?php
    129 if ($non_was_selected) { // no group pre-selected, display opening page
    130 ?>
    131 <div class="wrap">
    132 <dl>
    133 <?php
    134     //iterate through the available option groups. output them as a definition list.
    135     $option_groups = $wpdb->get_results("SELECT group_id, group_name, group_desc, group_longdesc FROM $wpdb->optiongroups ORDER BY group_id");
    136     foreach ($option_groups as $option_group) {
    137         echo("  <dt><a href=\"$this_file?option_group_id={$option_group->group_id}\" title=\"{$option_group->group_desc}\">{$option_group->group_name}</a></dt>\n");
    138         $current_long_desc = $option_group->group_longdesc;
    139         if ($current_long_desc == '') {
    140             $current_long_desc = __('No help for this group of options.');
    141         }
    142         echo("  <dd>{$option_group->group_desc}: $current_long_desc</dd>\n");
    143     } // end for each group
    144 ?>
    145   <dt><a href="options-permalink.php"><?php _e('Permalinks') ?></a></dt>
    146   <dd><?php _e('Permanent link configuration') ?></dd>
    147 </dl>
    148 </div>
    149 <?php   
    150 
    151 } else { //there was a group selected.
    152 include('options-head.php');
    153 ?>
     128<?php include('options-head.php'); ?>
    154129
    155130<div class="wrap">
  • trunk/wp-admin/upgrade-functions.php

    r1595 r1596  
    7171  seq int(11) NOT NULL default '0',
    7272  PRIMARY KEY  (group_id,option_id)
    73 );
    74 CREATE TABLE $wpdb->optiongroups (
    75   group_id int(11) NOT NULL auto_increment,
    76   group_name varchar(64) NOT NULL default '',
    77   group_desc varchar(255) default NULL,
    78   group_longdesc tinytext,
    79   PRIMARY KEY  (group_id)
    8073);
    8174CREATE TABLE $wpdb->options (
     
    218211    )
    219212    ");
    220     maybe_create_table($wpdb->optiongroups, "
    221     CREATE TABLE $wpdb->optiongroups (
    222       group_id int(11) NOT NULL auto_increment,
    223       group_name varchar(64) not null,
    224       group_desc varchar(255),
    225       group_longdesc tinytext,
    226       PRIMARY KEY (group_id)
    227     )
    228     ");
    229213    maybe_create_table($wpdb->optiongroup_options, "
    230214    CREATE TABLE $wpdb->optiongroup_options (
     
    329313    }
    330314   
    331     $option_groups = array(
    332     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (1, 'Other Options', 'Posts per page etc. Original options page')",
    333     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (2, 'General blog settings', 'Things you\'ll probably want to tweak')",
    334     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (3, 'RSS/RDF Feeds, Track/Ping-backs', 'Settings for RSS/RDF Feeds, Track/ping-backs')",
    335     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (4, 'File uploads', 'Settings for file uploads')",
    336     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (5, 'Blog-by-Email settings', 'Settings for blogging via email')",
    337     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (6, 'Base settings', 'Basic settings required to get your blog working')",
    338     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (7, 'Default post options', 'Default settings for new posts.')",
    339     "INSERT INTO $wpdb->optiongroups (group_id,  group_name, group_desc) VALUES (8, 'Link Manager Settings', 'Various settings for the link manager.')",
    340     "INSERT INTO $wpdb->optiongroups (group_id, group_name, group_desc) VALUES (9, 'Geo Options', 'Settings which control the posting and display of Geo Options')");
    341 
    342     foreach ($option_groups as $query) {
    343         $option_id = preg_match('|VALUES \(([0-9]+)|', $query, $matches);
    344         $option_id = $matches[1];
    345         if(!$wpdb->get_var("SELECT * FROM $wpdb->optiongroups WHERE group_id = '$option_id'")) {
    346             $wpdb->query($query);
    347             }
    348     }   
    349    
    350315    $optiongroup_options = array (      "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,48,1 )",
    351316        "INSERT INTO $wpdb->optiongroup_options (group_id, option_id, seq) VALUES (1,49,2 )",
     
    515480
    516481    $oid = $wpdb->get_var("SELECT option_id FROM $wpdb->options WHERE option_name = 'comment_moderation'");     
    517     $gid = $wpdb->get_var("SELECT group_id FROM $wpdb->optiongroups WHERE group_name = 'General blog settings'");
    518482    $seq = $wpdb->get_var("SELECT MAX(seq) FROM $wpdb->optiongroup_options WHERE group_id = '$gid'");
    519483    ++$seq;
     
    693657        }
    694658    }
    695    
    696     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 1");
    697     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 2");
    698     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 3");
    699     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 4");
    700     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 5");
    701     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 6");
    702     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 7");
    703     $wpdb->query("DELETE FROM $wpdb->optiongroups WHERE group_id = 9");
    704 
    705     $wpdb->query("UPDATE $wpdb->optiongroups SET group_name = 'Link Manager' WHERE group_id = 8");
    706659
    707660    // Add blog_charset option
     
    879832    $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optionvalues');
    880833    $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiontypes');
     834    $wpdb->query('DROP TABLE IF EXISTS ' . $table_prefix . 'optiongroups');
    881835}
    882836
Note: See TracChangeset for help on using the changeset viewer.