WordPress.org

Make WordPress Core

Changeset 1601


Ignore:
Timestamp:
09/05/04 01:22:17 (10 years ago)
Author:
saxmatt
Message:

Install and upgrade refactoring complete.

Location:
trunk
Files:
1 added
4 edited

Legend:

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

    r1597 r1601  
    55 
    66require_once('../wp-config.php'); 
    7 require('upgrade-functions.php'); 
     7require('./upgrade-functions.php'); 
    88 
    99$guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $HTTP_HOST . $REQUEST_URI); 
     
    6969<h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1> 
    7070<?php 
    71  
    7271// Let's check to make sure WP isn't already installed. 
    7372$wpdb->hide_errors(); 
     
    9089<p>Before we begin we need a little bit of information. Don't worry, you can always change these later. </p> 
    9190 
    92 <form name="form1" id="form1" method="post" action="install.php?step=2"> 
     91<form name="setup" id="setup" method="post" action="install.php?step=2"> 
    9392<table width="100%"> 
    9493<tr> 
     
    110109    break; 
    111110    case 2: 
    112 $weblog_title = addslashes(stripslashes(stripslashes($_POST['weblog_title']))); 
    113 $admin_email = addslashes(stripslashes(stripslashes($_POST['admin_email']))); 
    114111?> 
    115112<h1>Second Step</h1> 
    116113<p>Now we&#8217;re going to create the database tables and fill them with some default data.</p> 
    117114 
    118 <?php 
    119  
    120 $got_links = false; 
    121 $got_cats = false; 
    122 $got_row = false; 
    123 ?> 
    124 <?php 
    125 $result = mysql_list_tables(DB_NAME); 
    126 if (!$result) { 
    127     print "DB Error, could not list tables\n"; 
    128     print 'MySQL Error: ' . mysql_error(); 
    129     exit; 
    130 } 
    131  
    132 while ($row = mysql_fetch_row($result)) { 
    133     if ($row[0] == $wpdb->links) 
    134         $got_links = true; 
    135     if ($row[0] == $wpdb->linkcategories) 
    136         $got_cats = true; 
    137     //print "Table: $row[0]<br />\n"; 
    138 } 
    139 if (!$got_cats) { 
    140     $sql = "CREATE TABLE $wpdb->linkcategories ( " . 
    141            " cat_id int(11) NOT NULL auto_increment, " . 
    142            " cat_name tinytext NOT NULL, ". 
    143            " auto_toggle enum ('Y','N') NOT NULL default 'N', ". 
    144            " show_images enum ('Y','N') NOT NULL default 'Y',        " . 
    145            " show_description enum ('Y','N') NOT NULL default 'Y',   " . 
    146            " show_rating enum ('Y','N') NOT NULL default 'Y',        " . 
    147            " show_updated enum ('Y','N') NOT NULL default 'Y',       " . 
    148            " sort_order varchar(64) NOT NULL default 'name',         " . 
    149            " sort_desc enum('Y','N') NOT NULL default 'N',           " . 
    150            " text_before_link varchar(128) not null default '<li>',  " . 
    151            " text_after_link  varchar(128) not null default '<br />'," . 
    152            " text_after_all  varchar(128) not null default '</li>',  " . 
    153            " list_limit int not null default '-1',                     " . 
    154            " PRIMARY KEY (cat_id) ". 
    155            ") "; 
    156     $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.<br />" . $sql . "<br />" . mysql_error()); 
    157     if ($result != false) { 
    158         $got_cats = true; 
    159     } 
    160 } else { 
    161         $got_cats = true; 
    162 } 
    163 if (!$got_links) { 
    164     $sql = "CREATE TABLE $wpdb->links ( " . 
    165            " link_id int(11) NOT NULL auto_increment,           " . 
    166            " link_url varchar(255) NOT NULL default '',         " . 
    167            " link_name varchar(255) NOT NULL default '',        " . 
    168            " link_image varchar(255) NOT NULL default '',       " . 
    169            " link_target varchar(25) NOT NULL default '',       " . 
    170            " link_category int(11) NOT NULL default 0,          " . 
    171            " link_description varchar(255) NOT NULL default '', " . 
    172            " link_visible enum ('Y','N') NOT NULL default 'Y',  " . 
    173            " link_owner int NOT NULL DEFAULT '1',               " . 
    174            " link_rating int NOT NULL DEFAULT '0',              " . 
    175            " link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " . 
    176            " link_rel varchar(255) NOT NULL default '',         " . 
    177            " link_notes MEDIUMTEXT NOT NULL default '',         " . 
    178            " PRIMARY KEY (link_id)                              " . 
    179            ") "; 
    180     $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.<br />" . $sql . "<br />" . mysql_error()); 
    181     $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 
    182     $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 
    183     $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/journalized/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 
    184     $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://www.alexking.org/', 'Alex', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 
    185     $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://dougal.gunters.org/', 'Dougal', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); 
    186  
    187  
    188     if ($result != false) { 
    189         $got_links = true; 
    190     } 
    191 } else { 
    192         $got_links = true; 
    193 } 
    194  
    195 if ($got_links && $got_cats) { 
    196     $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; 
    197     $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.<br />" . $sql . "<br />" . mysql_error()); 
    198     if ($result != false) { 
    199         if ($row = mysql_fetch_object($result)) { 
    200             $got_row = true; 
    201         } else { 
    202             $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Links')"; 
    203             $result = mysql_query($sql) or print ("Can't query insert category.<br />" . $sql . "<br />" . mysql_error()); 
    204             if ($result != false) { 
    205                 $got_row = true; 
    206             } 
    207         } 
    208     } 
    209 } 
    210  
    211 ?> 
    212 <?php 
    213 # Note: if you want to start again with a clean b2 database, 
    214 #       just remove the // in this file 
    215  
    216 // $query = "DROP TABLE IF EXISTS $wpdb->posts"; 
    217 // $q = mysql_query($query) or die ("doh, can't drop the table \"$wpdb->posts\" in the database."); 
    218  
    219 $query = "CREATE TABLE $wpdb->posts ( 
    220   ID int(10) unsigned NOT NULL auto_increment, 
    221   post_author int(4) NOT NULL default '0', 
    222   post_date datetime NOT NULL default '0000-00-00 00:00:00', 
    223   post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    224   post_content text NOT NULL, 
    225   post_title text NOT NULL, 
    226   post_category int(4) NOT NULL default '0', 
    227   post_excerpt text NOT NULL, 
    228   post_lat float, 
    229   post_lon float, 
    230   post_status enum('publish','draft','private') NOT NULL default 'publish', 
    231   comment_status enum('open','closed') NOT NULL default 'open', 
    232   ping_status enum('open','closed') NOT NULL default 'open', 
    233   post_password varchar(20) NOT NULL default '', 
    234   post_name varchar(200) NOT NULL default '', 
    235   to_ping text NOT NULL, 
    236   pinged text NOT NULL, 
    237   post_modified datetime NOT NULL default '0000-00-00 00:00:00', 
    238   post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    239   post_content_filtered text NOT NULL, 
    240   PRIMARY KEY  (ID), 
    241   KEY post_date (post_date), 
    242   KEY post_date_gmt (post_date_gmt), 
    243   KEY post_name (post_name), 
    244   KEY post_status (post_status) 
    245 ) 
    246 "; 
    247 $q = $wpdb->query($query); 
    248 ?> 
    249115 
    250116<?php 
     117flush(); 
     118 
     119// Set everything up 
     120make_db_current_silent(); 
     121populate_options(); 
     122 
     123// Fill in the data we gathered 
     124$weblog_title = addslashes(stripslashes(stripslashes($_POST['weblog_title']))); 
     125$admin_email = addslashes(stripslashes(stripslashes($_POST['admin_email']))); 
     126 
     127$wpdb->query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'"); 
     128$wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'"); 
     129 
     130// Now drop in some default links 
     131$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Blogroll')"); 
     132$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://photomatt.net/', 'Matt', 1);"); 
     133$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://zed1.com/journalized/', 'Mike', 1);"); 
     134$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://www.alexking.org/', 'Alex', 1);"); 
     135$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://dougal.gunters.org/', 'Dougal', 1);"); 
     136 
     137// Default category 
     138$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'Uncategorized')"); 
     139 
     140// First post 
    251141$now = date('Y-m-d H:i:s'); 
    252142$now_gmt = gmdate('Y-m-d H:i:s'); 
    253 $query = "INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', 'Welcome to WordPress. This is the first post. Edit or delete it, then start blogging!', 'Hello world!', '$now', '$now_gmt')"; 
     143$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_modified, post_modified_gmt) VALUES ('1', '$now', '$now_gmt', 'Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!', 'Hello world!', '$now', '$now_gmt')"); 
    254144 
    255 $q = $wpdb->query($query); 
    256 ?> 
     145// Default comment 
     146$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', 'Mr WordPress', 'mr@wordpress.org', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', 'Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')"); 
    257147 
    258 <?php 
    259 // $query = "DROP TABLE IF EXISTS $wpdb->categories"; 
    260 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->categories\" in the database."); 
    261  
    262 $query = " 
    263 CREATE TABLE $wpdb->categories ( 
    264   cat_ID int(4) NOT NULL auto_increment, 
    265   cat_name varchar(55) NOT NULL default '', 
    266   PRIMARY KEY  (cat_ID), 
    267   UNIQUE (cat_name) 
    268 ) 
    269 "; 
    270 $q = $wpdb->query($query); 
    271  
    272 $query = "INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'General')"; 
    273 $q = $wpdb->query($query); 
    274  
    275 $query = "UPDATE $wpdb->posts SET post_category = 1"; 
    276 $result = $wpdb->query($query); 
    277 ?> 
    278  
    279 <?php 
    280 // $query = "DROP TABLE IF EXISTS $wpdb->comments"; 
    281 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->comments\" in the database."); 
    282  
    283 $query = " 
    284 CREATE TABLE $wpdb->comments ( 
    285   comment_ID int(11) unsigned NOT NULL auto_increment, 
    286   comment_post_ID int(11) NOT NULL default '0', 
    287   comment_author tinytext NOT NULL, 
    288   comment_author_email varchar(100) NOT NULL default '', 
    289   comment_author_url varchar(100) NOT NULL default '', 
    290   comment_author_IP varchar(100) NOT NULL default '', 
    291   comment_date datetime NOT NULL default '0000-00-00 00:00:00', 
    292   comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    293   comment_content text NOT NULL, 
    294   comment_karma int(11) NOT NULL default '0', 
    295   PRIMARY KEY  (comment_ID) 
    296 ) 
    297 "; 
    298 $q = $wpdb->query($query); 
    299  
    300 $now = date('Y-m-d H:i:s'); 
    301 $now_gmt = gmdate('Y-m-d H:i:s'); 
    302 $query = "INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content) VALUES ('1', 'Mr WordPress', 'mr@wordpress.org', 'http://wordpress.org', '127.0.0.1', '$now', '$now_gmt', 'Hi, this is a comment.<br />To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')"; 
    303 $q = $wpdb->query($query); 
    304 ?> 
    305  
    306 <?php 
    307 $query = " 
    308     CREATE TABLE $wpdb->postmeta ( 
    309       meta_id int(11) NOT NULL auto_increment, 
    310       post_id int(11) NOT NULL default 0, 
    311       meta_key varchar(255), 
    312       meta_value text, 
    313       PRIMARY KEY (meta_id), 
    314       INDEX (post_id), 
    315       INDEX (meta_key) 
    316     ) 
    317     "; 
    318  
    319 $q = $wpdb->query($query); 
    320  
    321  
    322 ?> 
    323  
    324 <?php 
    325 // $query = "DROP TABLE IF EXISTS $wpdb->options"; 
    326 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->options\" in the database."); 
    327  
    328 $query = " 
    329 CREATE TABLE $wpdb->options ( 
    330   option_id int(11) NOT NULL auto_increment, 
    331   blog_id int(11) NOT NULL default 0, 
    332   option_name varchar(64) NOT NULL default '', 
    333   option_can_override enum ('Y','N') NOT NULL default 'Y', 
    334   option_type int(11) NOT NULL default 1, 
    335   option_value varchar(255) NOT NULL default '', 
    336   option_width int NOT NULL default 20, 
    337   option_height int NOT NULL default 8, 
    338   option_description tinytext NOT NULL default '', 
    339   option_admin_level int NOT NULL DEFAULT '1', 
    340   PRIMARY KEY (option_id, blog_id, option_name) 
    341 ) 
    342 "; 
    343 $q = $wpdb->query($query); 
    344  
    345 $option_data = array( 
    346 //base options from b2cofig 
    347 "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)", 
    348 "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)", 
    349 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(3,'blogname', 3, '$weblog_title', 'blogname is the name of your blog', 8, 20)", 
    350 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(4,'blogdescription', 3, 'My WordPress weblog', 'blogdescription is the description of your blog', 8, 40)", 
    351 //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(6,'search_engine_friendly_urls', 2, '0', 'Querystring Configuration ** (don\'t change if you don\'t know what you\'re doing)', 8, 20)", 
    352 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(7,'new_users_can_blog', 2, '0', 'whether you want new users to be able to post entries once they have registered', 8, 20)", 
    353 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(8,'users_can_register', 2, '1', 'whether you want to allow users to register on your blog', 8, 20)", 
    354 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(54,'admin_email', 3, '$admin_email', 'Your email (obvious eh?)', 8, 20)", 
    355 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level) VALUES (93, 'blog_charset', 3, 'utf-8', 'Your blog&#8217;s charset (here&#8217;s a <a href=\'http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html\'>list of possible charsets</a>)', 8)", 
    356 // general blog setup 
    357 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(9 ,'start_of_week', 5, '1', 'day at the start of the week', 8, 20)", 
    358 //"INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(10,'use_preview', 2, '1', 'Do you want to use the \'preview\' function', 8, 20)", 
    359 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(14,'use_htmltrans', 2, '1', 'IMPORTANT! set this to false if you are using Chinese, Japanese, Korean, or other double-bytes languages', 8, 20)", 
    360 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(15,'use_balanceTags', 2, '1', 'this could help balance your HTML code. if it gives bad results, set it to false', 8, 20)", 
    361 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(16,'use_smilies', 2, '1', 'set this to 1 to enable smiley conversion in posts (note: this makes smiley conversion in ALL posts)', 8, 20)", 
    362 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(18,'require_name_email', 2, '0', 'set this to true to require e-mail and name, or false to allow comments without e-mail/name', 8, 20)", 
    363 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(20,'comments_notify', 2, '1', 'set this to true to let every author be notified about comments on their posts', 8, 20)", 
    364 //rss/rdf feeds 
    365 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(21,'posts_per_rss', 1, '10', 'number of last posts to syndicate', 8, 20)", 
    366 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(22,'rss_language', 3, 'en', 'the language of your blog ( see this: http://backend.userland.com/stories/storyReader$16 )', 8, 20)", 
    367 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(23,'rss_encoded_html', 2, '0', 'for b2rss.php: allow encoded HTML in &lt;description> tag?', 8, 20)", 
    368 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(24,'rss_excerpt_length', 1, '50', 'length (in words) of excerpts in the RSS feed? 0=unlimited note: in b2rss.php, this will be set to 0 if you use encoded HTML', 8, 20)", 
    369 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(25,'rss_use_excerpt', 2, '0', 'use the excerpt field for rss feed.', 8, 20)", 
    370 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(29,'use_trackback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be trackback\'able or not note: setting it to zero would also disable sending trackbacks', 8, 20)", 
    371 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(30,'use_pingback', 2, '1', 'set this to 0 or 1, whether you want to allow your posts to be pingback\'able or not note: setting it to zero would also disable sending pingbacks', 8, 20)", 
    372 //file upload 
    373 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(31,'use_fileupload', 2, '0', 'set this to false to disable file upload, or true to enable it', 8, 20)", 
    374 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(32,'fileupload_realpath', 3, '/home/your/site/wordpress/images', 'enter the real path of the directory where you\'ll upload the pictures \nif you\'re unsure about what your real path is, please ask your host\'s support staff \nnote that the  directory must be writable by the webserver (chmod 766) \nnote for windows-servers users: use forwardslashes instead of backslashes', 8, 40)", 
    375 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(33,'fileupload_url', 3, 'http://example.com/images', 'enter the URL of that directory (it\'s used to generate the links to the uploded files)', 8, 40)", 
    376 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(34,'fileupload_allowedtypes', 3, 'jpg jpeg gif png', 'accepted file types, separated by spaces. example: \'jpg gif png\'', 8, 20)", 
    377 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(35,'fileupload_maxk', 1, '96', 'by default, most servers limit the size of uploads to 2048 KB, if you want to set it to a lower value, here it is (you cannot set a higher value than your server limit)', 8, 20)", 
    378 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(36,'fileupload_minlevel', 1, '4', 'you may not want all users to upload pictures/files, so you can set a minimum level for this', 8, 20)", 
    379 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(37,'fileupload_allowedusers', 3, '', '...or you may authorize only some users. enter their logins here, separated by spaces. if you leave this variable blank, all users who have the minimum level are authorized to upload. example: \'barbara anne george\'', 8, 30)", 
    380 // email settings 
    381 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(38,'mailserver_url', 3, 'mail.example.com', 'mailserver settings', 8, 20)", 
    382 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(39,'mailserver_login', 3, 'login@example.com', 'mailserver settings', 8, 20)", 
    383 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(40,'mailserver_pass', 3, 'password', 'mailserver settings', 8, 20)", 
    384 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(41,'mailserver_port', 1, '110', 'mailserver settings', 8, 20)", 
    385 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(42,'default_category', 1, '1', 'by default posts will have this category', 8, 20)", 
    386 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(46,'use_phoneemail', 2, '0', 'some mobile phone email services will send identical subject & content on the same line if you use such a service, set use_phoneemail to true, and indicate a separator string', 8, 20)", 
    387 // original options from options page 
    388 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(48,'posts_per_page', 1, '10','How many posts/days to show on the index page.', 4, 20)", 
    389 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(49,'what_to_show', 5, 'posts','Posts or days', 4, 20)", 
    390 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(50,'archive_mode', 5, 'monthly','Which \'unit\' to use for archives.', 4, 20)", 
    391 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(51,'time_difference', 6, '0', 'if you\'re not on the timezone of your server', 4, 20)", 
    392 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(52,'date_format', 3, 'n/j/Y', 'see note for format characters', 4, 20)", 
    393 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(53,'time_format', 3, 'g:i a', 'see note for format characters', 4, 20)", 
    394  
    395 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(55,'default_post_status',    5, 'publish', 'The default state of each new post', 8, 20)", 
    396 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(56,'default_comment_status', 5, 'open', 'The default state of comments for each new post', 8, 20)", 
    397 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(57,'default_ping_status',    5, 'open', 'The default ping state for each new post', 8, 20)", 
    398 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(58,'default_pingback_flag',  5, '1', 'Whether the \'PingBack the URLs in this post\' checkbox should be checked by default', 8, 20)", 
    399 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(59,'default_post_category',  7, '1', 'The default category for each new post', 8, 20)", 
    400 "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)", 
    401  
    402 ); 
    403  
    404 foreach ($option_data as $query) { 
    405     $q = $wpdb->query($query); 
    406 } 
    407 ?> 
    408  
    409  
    410  
    411 <?php 
    412 $links_option_data = array( 
    413 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(60,'links_minadminlevel',    1, '5', 'The minimum admin level to edit links', 8, 10)", 
    414 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(61,'links_use_adminlevels',  2, '1', 'set this to false to have all links visible and editable to everyone in the link manager', 8, 20)", 
    415 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(62,'links_rating_type',      5, 'image', 'Set this to the type of rating indication you wish to use', 8, 10)", 
    416 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(63,'links_rating_char',      3, '*', 'If we are set to \'char\' which char to use.', 8, 5)", 
    417 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(64,'links_rating_ignore_zero', 2, '1', 'What do we do with a value of zero? set this to true to output nothing, 0 to output as normal (number/image)', 8, 20)", 
    418 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(65,'links_rating_single_image',  2, '1', 'Use the same image for each rating point? (Uses links_rating_image[0])', 8, 20)", 
    419 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(66,'links_rating_image0',  3, 'wp-links/links-images/tick.png', 'Image for rating 0 (and for single image)', 8, 40)", 
    420 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(67,'links_rating_image1',  3, 'wp-links/links-images/rating-1.gif', 'Image for rating 1', 8, 40)", 
    421 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(68,'links_rating_image2',  3, 'wp-links/links-images/rating-2.gif', 'Image for rating 2', 8, 40)", 
    422 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(69,'links_rating_image3',  3, 'wp-links/links-images/rating-3.gif', 'Image for rating 3', 8, 40)", 
    423 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(70,'links_rating_image4',  3, 'wp-links/links-images/rating-4.gif', 'Image for rating 4', 8, 40)", 
    424 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(71,'links_rating_image5',  3, 'wp-links/links-images/rating-5.gif', 'Image for rating 5', 8, 40)", 
    425 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(72,'links_rating_image6',  3, 'wp-links/links-images/rating-6.gif', 'Image for rating 6', 8, 40)", 
    426 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(73,'links_rating_image7',  3, 'wp-links/links-images/rating-7.gif', 'Image for rating 7', 8, 40)", 
    427 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(74,'links_rating_image8',  3, 'wp-links/links-images/rating-8.gif', 'Image for rating 8', 8, 40)", 
    428 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(75,'links_rating_image9',  3, 'wp-links/links-images/rating-9.gif', 'Image for rating 9', 8, 40)", 
    429 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(77,'weblogs_xml_url',      3, 'http://www.weblogs.com/changes.xml', 'Which file to grab from weblogs.com', 8, 40)", 
    430 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(78,'weblogs_cacheminutes', 1, '60', 'cache time in minutes (if it is older than this get a new copy)', 8, 10)", 
    431 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(79,'links_updated_date_format',  3, 'd/m/Y h:i', 'The date format for the updated tooltip', 8, 25)", 
    432 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(80,'links_recently_updated_prepend',  3, '&gt;&gt;', 'The text to prepend to a recently updated link', 8, 10)", 
    433 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(81,'links_recently_updated_append',  3, '&lt;&lt;', 'The text to append to a recently updated link', 8, 20)", 
    434 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(82,'links_recently_updated_time',  1, '120', 'The time in minutes to consider a link recently updated', 8, 20)", 
    435 ); 
    436  
    437 foreach ($links_option_data as $query) { 
    438     $q = $wpdb->query($query); 
    439 } 
    440 ?> 
    441  
    442  
    443 <?php 
    444 $geo_option_data = array( 
    445 // data for geo settings 
    446 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(84,'use_geo_positions', 2, '0', 'Turns on the geo url features of WordPress', 8, 20)", 
    447 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(85,'use_default_geourl', 2, '1','enables placement of default GeoURL ICBM location even when no other specified', 8, 20)", 
    448 "INSERT INTO $wpdb->options (option_id, option_name, option_type, option_value, option_description, option_admin_level, option_width) VALUES(86,'default_geourl_lat ', 8, 0.0, 'The default Latitude ICBM value - <a href=\"http://www.geourl.org/resources.html\" target=\"_blank\">see here</a>', 8, 20)", 
    449 "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)", 
    450 ); 
    451  
    452 foreach ($geo_option_data as $query) { 
    453     $q = $wpdb->query($query); 
    454 } 
    455 ?> 
    456  
    457 <p>Groovy. We're almost done.</p> 
    458  
    459 <h1>Third Step</h1> 
    460 <?php 
    461 // $query = "DROP TABLE IF EXISTS $wpdb->users"; 
    462 // $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->users\" in the database."); 
    463  
    464 $query = " 
    465 CREATE TABLE $wpdb->users ( 
    466   ID int(10) unsigned NOT NULL auto_increment, 
    467   user_login varchar(20) NOT NULL default '', 
    468   user_pass varchar(64) NOT NULL default '', 
    469   user_firstname varchar(50) NOT NULL default '', 
    470   user_lastname varchar(50) NOT NULL default '', 
    471   user_nickname varchar(50) NOT NULL default '', 
    472   user_icq int(10) unsigned NOT NULL default '0', 
    473   user_email varchar(100) NOT NULL default '', 
    474   user_url varchar(100) NOT NULL default '', 
    475   user_ip varchar(15) NOT NULL default '', 
    476   user_domain varchar(200) NOT NULL default '', 
    477   user_browser varchar(200) NOT NULL default '', 
    478   dateYMDhour datetime NOT NULL default '0000-00-00 00:00:00', 
    479   user_level int(2) unsigned NOT NULL default '0', 
    480   user_aim varchar(50) NOT NULL default '', 
    481   user_msn varchar(100) NOT NULL default '', 
    482   user_yim varchar(50) NOT NULL default '', 
    483   user_idmode varchar(20) NOT NULL default '', 
    484   PRIMARY KEY  (ID), 
    485   UNIQUE KEY (user_login) 
    486 ) 
    487 "; 
    488 $q = $wpdb->query($query); 
    489  
    490 $random_password = substr(md5(uniqid(microtime())),0,6); 
    491  
    492 $query = "INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode) VALUES ( '1', 'admin', MD5('$random_password'), 'Administrator', '$admin_email', '10', 'nickname')"; 
    493 $q = $wpdb->query($query); 
    494  
    495 // Do final updates 
    496 upgrade_all(); 
     148// Set up admin user 
     149$random_password = substr(md5(uniqid(microtime())), 0, 6); 
     150$wpdb->query("INSERT INTO $wpdb->users (ID, user_login, user_pass, user_nickname, user_email, user_level, user_idmode) VALUES ( '1', 'admin', MD5('$random_password'), 'Administrator', '$admin_email', '10', 'nickname')"); 
    497151 
    498152mail($admin_email, 'New WordPress Blog', "Your new WordPress blog has been sucessfully set up at: 
     
    510164http://wordpress.org/ 
    511165"); 
     166 
     167upgrade_all(); 
    512168?> 
    513169 
    514 <p>User setup successful!</p> 
     170<p><em>Finished!</em></p> 
    515171 
    516172<p>Now you can <a href="../wp-login.php">log in</a> with the <strong>login</strong> 
     
    525181<dt>Password</dt> 
    526182<dd><code><?php echo $random_password; ?></code></dd> 
     183<dt>Login address</dt> 
     184<dd><a href="../wp-login.php">wp-login.php</a></dd> 
    527185</dl> 
    528 <p>Were you expecting more steps? Sorry to disappoint. All done!</p> 
     186<p>Were you expecting more steps? Sorry to disappoint. All done! :)</p> 
    529187<?php 
    530188    break; 
  • trunk/wp-admin/upgrade-functions.php

    r1599 r1601  
    11<?php 
     2require_once('./upgrade-schema.php'); 
    23// Functions to be called in install and upgrade scripts 
    3  
    4 // First let's set up the tables: 
    5  
    6 $wp_queries="CREATE TABLE $wpdb->categories ( 
    7   cat_ID int(4) NOT NULL auto_increment, 
    8   cat_name varchar(55) NOT NULL default '', 
    9   category_nicename varchar(200) NOT NULL default '', 
    10   category_description text NOT NULL, 
    11   category_parent int(4) NOT NULL default '0', 
    12   PRIMARY KEY  (cat_ID), 
    13   UNIQUE KEY cat_name (cat_name), 
    14   KEY category_nicename (category_nicename) 
    15 ); 
    16 CREATE TABLE $wpdb->comments ( 
    17   comment_ID int(11) unsigned NOT NULL auto_increment, 
    18   comment_post_ID int(11) NOT NULL default '0', 
    19   comment_author tinytext NOT NULL, 
    20   comment_author_email varchar(100) NOT NULL default '', 
    21   comment_author_url varchar(200) NOT NULL default '', 
    22   comment_author_IP varchar(100) NOT NULL default '', 
    23   comment_date datetime NOT NULL default '0000-00-00 00:00:00', 
    24   comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    25   comment_content text NOT NULL, 
    26   comment_karma int(11) NOT NULL default '0', 
    27   comment_approved enum('0','1') NOT NULL default '1', 
    28   user_id int(11) NOT NULL default '0', 
    29   PRIMARY KEY  (comment_ID), 
    30   KEY comment_approved (comment_approved), 
    31   KEY comment_post_ID (comment_post_ID) 
    32 ); 
    33 CREATE TABLE $wpdb->linkcategories ( 
    34   cat_id int(11) NOT NULL auto_increment, 
    35   cat_name tinytext NOT NULL, 
    36   auto_toggle enum('Y','N') NOT NULL default 'N', 
    37   show_images enum('Y','N') NOT NULL default 'Y', 
    38   show_description enum('Y','N') NOT NULL default 'N', 
    39   show_rating enum('Y','N') NOT NULL default 'Y', 
    40   show_updated enum('Y','N') NOT NULL default 'Y', 
    41   sort_order varchar(64) NOT NULL default 'name', 
    42   sort_desc enum('Y','N') NOT NULL default 'N', 
    43   text_before_link varchar(128) NOT NULL default '<li>', 
    44   text_after_link varchar(128) NOT NULL default '<br />', 
    45   text_after_all varchar(128) NOT NULL default '</li>', 
    46   list_limit int(11) NOT NULL default '-1', 
    47   PRIMARY KEY  (cat_id) 
    48 ); 
    49 CREATE TABLE $wpdb->links ( 
    50   link_id int(11) NOT NULL auto_increment, 
    51   link_url varchar(255) NOT NULL default '', 
    52   link_name varchar(255) NOT NULL default '', 
    53   link_image varchar(255) NOT NULL default '', 
    54   link_target varchar(25) NOT NULL default '', 
    55   link_category int(11) NOT NULL default '0', 
    56   link_description varchar(255) NOT NULL default '', 
    57   link_visible enum('Y','N') NOT NULL default 'Y', 
    58   link_owner int(11) NOT NULL default '1', 
    59   link_rating int(11) NOT NULL default '0', 
    60   link_updated datetime NOT NULL default '0000-00-00 00:00:00', 
    61   link_rel varchar(255) NOT NULL default '', 
    62   link_notes mediumtext NOT NULL, 
    63   link_rss varchar(255) NOT NULL default '', 
    64   PRIMARY KEY  (link_id), 
    65   KEY link_category (link_category), 
    66   KEY link_visible (link_visible) 
    67 ); 
    68 CREATE TABLE $wpdb->options ( 
    69   option_id int(11) NOT NULL auto_increment, 
    70   blog_id int(11) NOT NULL default '0', 
    71   option_name varchar(64) NOT NULL default '', 
    72   option_can_override enum('Y','N') NOT NULL default 'Y', 
    73   option_type int(11) NOT NULL default '1', 
    74   option_value text NOT NULL, 
    75   option_width int(11) NOT NULL default '20', 
    76   option_height int(11) NOT NULL default '8', 
    77   option_description tinytext NOT NULL, 
    78   option_admin_level int(11) NOT NULL default '1', 
    79   autoload enum('yes','no') NOT NULL default 'yes', 
    80   PRIMARY KEY  (option_id,blog_id,option_name) 
    81 ); 
    82 CREATE TABLE $wpdb->post2cat ( 
    83   rel_id int(11) NOT NULL auto_increment, 
    84   post_id int(11) NOT NULL default '0', 
    85   category_id int(11) NOT NULL default '0', 
    86   PRIMARY KEY  (rel_id), 
    87   KEY post_id (post_id,category_id) 
    88 ); 
    89 CREATE TABLE $wpdb->postmeta ( 
    90   meta_id int(11) NOT NULL auto_increment, 
    91   post_id int(11) NOT NULL default '0', 
    92   meta_key varchar(255) default NULL, 
    93   meta_value text, 
    94   PRIMARY KEY  (meta_id), 
    95   KEY post_id (post_id), 
    96   KEY meta_key (meta_key) 
    97 ); 
    98 CREATE TABLE $wpdb->posts ( 
    99   ID int(10) unsigned NOT NULL auto_increment, 
    100   post_author int(4) NOT NULL default '0', 
    101   post_date datetime NOT NULL default '0000-00-00 00:00:00', 
    102   post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    103   post_content text NOT NULL, 
    104   post_title text NOT NULL, 
    105   post_category int(4) NOT NULL default '0', 
    106   post_excerpt text NOT NULL, 
    107   post_lat float default NULL, 
    108   post_lon float default NULL, 
    109   post_status enum('publish','draft','private','static') NOT NULL default 'publish', 
    110   comment_status enum('open','closed','registered_only') NOT NULL default 'open', 
    111   ping_status enum('open','closed') NOT NULL default 'open', 
    112   post_password varchar(20) NOT NULL default '', 
    113   post_name varchar(200) NOT NULL default '', 
    114   to_ping text NOT NULL, 
    115   pinged text NOT NULL, 
    116   post_modified datetime NOT NULL default '0000-00-00 00:00:00', 
    117   post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', 
    118   post_content_filtered text NOT NULL, 
    119   post_parent int(11) NOT NULL default '0', 
    120   PRIMARY KEY  (ID), 
    121   KEY post_date (post_date), 
    122   KEY post_date_gmt (post_date_gmt), 
    123   KEY post_name (post_name), 
    124   KEY post_status (post_status) 
    125 ); 
    126 CREATE TABLE $wpdb->users ( 
    127   ID int(10) unsigned NOT NULL auto_increment, 
    128   user_login varchar(20) NOT NULL default '', 
    129   user_pass varchar(64) NOT NULL default '', 
    130   user_firstname varchar(50) NOT NULL default '', 
    131   user_lastname varchar(50) NOT NULL default '', 
    132   user_nickname varchar(50) NOT NULL default '', 
    133   user_nicename varchar(50) NOT NULL default '', 
    134   user_icq int(10) unsigned NOT NULL default '0', 
    135   user_email varchar(100) NOT NULL default '', 
    136   user_url varchar(100) NOT NULL default '', 
    137   user_ip varchar(15) NOT NULL default '', 
    138   user_domain varchar(200) NOT NULL default '', 
    139   user_browser varchar(200) NOT NULL default '', 
    140   dateYMDhour datetime NOT NULL default '0000-00-00 00:00:00', 
    141   user_level int(2) unsigned NOT NULL default '0', 
    142   user_aim varchar(50) NOT NULL default '', 
    143   user_msn varchar(100) NOT NULL default '', 
    144   user_yim varchar(50) NOT NULL default '', 
    145   user_idmode varchar(20) NOT NULL default '', 
    146   user_activation_key varchar(60) NOT NULL default '', 
    147   user_status int(11) NOT NULL default '0', 
    148   PRIMARY KEY  (ID), 
    149   UNIQUE KEY user_login (user_login) 
    150 );"; 
    151  
    152  
    153  
    1544function upgrade_all() { 
    1555    populate_options(); 
    156     upgrade_071(); 
    157     upgrade_072(); 
    1586    upgrade_100(); 
    1597    upgrade_101(); 
     
    16210} 
    16311 
    164 function populate_options() { 
    165  
    166     $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); 
    167     add_option('siteurl', $guessurl, 'WordPress web address'); 
    168     add_option('blogfilename', '', 'Default file for blog'); 
    169     add_option('blogname', 'My Weblog', 'Blog title'); 
    170     add_option('blogdescription', '', 'Short tagline'); 
    171     add_option('new_users_can_blog', 0); 
    172     add_option('users_can_register', 1); 
    173     add_option('admin_email', 'you@example.com'); 
    174     add_option('start_of_week', 1); 
    175     add_option('use_balanceTags', 1); 
    176     add_option('use_smilies', 1); 
    177     add_option('require_name_email', 1); 
    178     add_option('comments_notify', 1); 
    179     add_option('posts_per_rss', 10); 
    180     add_option('rss_excerpt_length', 50); 
    181     add_option('rss_use_excerpt', 0); 
    182     add_option('use_fileupload', 0); 
    183     add_option('fileupload_realpath', ABSPATH . 'wp-content'); 
    184     add_option('fileupload_url', get_option('siteurl') . '/wp-content'); 
    185     add_option('fileupload_allowedtypes', 'jpg jpeg gif png'); 
    186     add_option('fileupload_maxk', 300); 
    187     add_option('fileupload_minlevel', 6); 
    188     add_option('mailserver_url', 'mail.example.com'); 
    189     add_option('mailserver_login', 'login@example.com'); 
    190     add_option('mailserver_pass', 'password'); 
    191     add_option('mailserver_port', 110); 
    192     add_option('default_category', 1); 
    193     add_option('default_comment_status', 'open'); 
    194     add_option('default_ping_status', 'open'); 
    195     add_option('default_pingback_flag', 1); 
    196     add_option('default_post_edit_rows', 9); 
    197     add_option('posts_per_page', 10); 
    198     add_option('what_to_show', 'posts'); 
    199     add_option('date_format', 'F j, Y'); 
    200     add_option('time_format', 'g:i a'); 
    201     add_option('use_geo_positions', 0); 
    202     add_option('use_default_geourl', 0); 
    203     add_option('default_geourl_lat', 0); 
    204     add_option('default_geourl_lon', 0); 
    205     add_option('weblogs_xml_url', 'http://static.wordpress.org/changes.xml'); 
    206     add_option('links_updated_date_format', 'F j, Y g:i a'); 
    207     add_option('links_recently_updated_prepend', '<em>'); 
    208     add_option('links_recently_updated_append', '</em>'); 
    209     add_option('links_recently_updated_time', 120); 
    210     add_option('comment_moderation', 0); 
    211     add_option('moderation_notify', 1); 
    212     add_option('permalink_structure'); 
    213     add_option('gzipcompression', 0); 
    214     add_option('hack_file', 0); 
    215     add_option('blog_charset', 'utf-8'); 
    216     add_option('moderation_keys'); 
    217     add_option('active_plugins'); 
    218     add_option('home'); 
    219     add_option('category_base'); 
    220     add_option('ping_sites', 'http://rpc.pingomatic.com/'); 
    221     add_option('advanced_edit', 0); 
    222     add_option('comment_max_links', 2); 
    223  
    224     // Delete unused options 
    225     $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'rss_language', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls'); 
    226     foreach ($unusedoptions as $option) : 
    227         delete_option($option); 
    228     endforeach; 
    229 } 
    230  
    231 function upgrade_071() { 
    232     global $wpdb; 
    233     maybe_add_column($wpdb->posts, 'post_status', "ALTER TABLE $wpdb->posts ADD `post_status` ENUM('publish','draft','private') NOT NULL"); 
    234     maybe_add_column($wpdb->posts, 'comment_status', "ALTER TABLE $wpdb->posts ADD `comment_status` ENUM('open','closed') NOT NULL"); 
    235     maybe_add_column($wpdb->posts, 'ping_status', "ALTER TABLE $wpdb->posts ADD `ping_status` ENUM('open','closed') NOT NULL"); 
    236     maybe_add_column($wpdb->posts, 'post_password', "ALTER TABLE $wpdb->posts ADD post_password varchar(20) NOT NULL"); 
    237 } 
    238  
    239 function upgrade_072() { 
    240     global $wpdb; 
    241     maybe_add_column($wpdb->links, 'link_notes', "ALTER TABLE $wpdb->links ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' "); 
    242     maybe_add_column($wpdb->linkcategories, 'show_images', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_images enum('Y','N') NOT NULL default 'Y'"); 
    243     maybe_add_column($wpdb->linkcategories, 'show_description', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_description enum('Y','N') NOT NULL default 'Y'"); 
    244     maybe_add_column($wpdb->linkcategories, 'show_rating', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_rating enum('Y','N') NOT NULL default 'Y'"); 
    245     maybe_add_column($wpdb->linkcategories, 'show_updated', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_updated enum('Y','N') NOT NULL default 'Y'"); 
    246     maybe_add_column($wpdb->linkcategories, 'sort_order', "ALTER TABLE $wpdb->linkcategories ADD COLUMN sort_order varchar(64) NOT NULL default 'name'"); 
    247     maybe_add_column($wpdb->linkcategories, 'sort_desc', "ALTER TABLE $wpdb->linkcategories ADD COLUMN sort_desc enum('Y','N') NOT NULL default 'N'"); 
    248     maybe_add_column($wpdb->linkcategories, 'text_before_link', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_before_link varchar(128) not null default '<li>'"); 
    249     maybe_add_column($wpdb->linkcategories, 'text_after_link', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_after_link  varchar(128) not null default '<br />'"); 
    250     maybe_add_column($wpdb->linkcategories, 'text_after_all', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_after_all  varchar(128) not null default '</li>'"); 
    251     maybe_add_column($wpdb->linkcategories, 'list_limit', "ALTER TABLE $wpdb->linkcategories ADD COLUMN list_limit int not null default -1"); 
    252     maybe_add_column($wpdb->posts, 'post_lon', "ALTER TABLE $wpdb->posts ADD COLUMN post_lon float"); 
    253     maybe_add_column($wpdb->posts, 'post_lat', "ALTER TABLE $wpdb->posts ADD COLUMN post_lat float "); 
    254     maybe_create_table($wpdb->options, " 
    255     CREATE TABLE $wpdb->options ( 
    256       option_id int(11) NOT NULL auto_increment, 
    257       blog_id int(11) NOT NULL default 0, 
    258       option_name varchar(64) NOT NULL default '', 
    259       option_can_override enum('Y','N') NOT NULL default 'Y', 
    260       option_type int(11) NOT NULL default 1, 
    261       option_value varchar(255) NOT NULL default '', 
    262       option_width int NOT NULL default 20, 
    263       option_height int NOT NULL default 8, 
    264       option_description tinytext NOT NULL default '', 
    265       option_admin_level int NOT NULL DEFAULT '1', 
    266       PRIMARY KEY (option_id, blog_id, option_name) 
    267     ) 
    268     "); 
    269 } 
    270  
    27112function upgrade_100() { 
    27213    global $wpdb; 
    273     maybe_add_column($wpdb->posts, 'post_name', "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL"); 
    274     maybe_add_column($wpdb->posts, 'to_ping', "ALTER TABLE $wpdb->posts ADD `to_ping` TEXT NOT NULL"); 
    275     maybe_add_column($wpdb->posts, 'pinged', "ALTER TABLE $wpdb->posts ADD `pinged` TEXT NOT NULL"); 
    276     maybe_add_column($wpdb->posts, 'post_modified', "ALTER TABLE $wpdb->posts ADD `post_modified` DATETIME NOT NULL"); 
    277     maybe_add_column($wpdb->posts, 'post_content_filtered', "ALTER TABLE $wpdb->posts ADD `post_content_filtered` TEXT NOT NULL"); 
    278     maybe_add_column($wpdb->categories, 'category_nicename', "ALTER TABLE `$wpdb->categories` ADD `category_nicename` VARCHAR(200) NOT NULL");   
    279     maybe_add_column($wpdb->categories, 'category_description', "ALTER TABLE `$wpdb->categories` ADD `category_description` TEXT NOT NULL"); 
    280     maybe_add_column($wpdb->categories, 'category_parent', "ALTER TABLE `$wpdb->categories` ADD `category_parent` INT(4) NOT NULL"); 
    281     maybe_add_column($wpdb->links, 'link_rss', "ALTER TABLE `$wpdb->links` ADD `link_rss` VARCHAR( 255 ) NOT NULL;"); 
    282     maybe_add_column($wpdb->users, 'user_description', "ALTER TABLE `$wpdb->users` ADD `user_description` TEXT NOT NULL"); 
    283     maybe_add_column($wpdb->comments, 'comment_approved', "ALTER TABLE $wpdb->comments ADD COLUMN comment_approved ENUM('0', '1') DEFAULT '1' NOT NULL"); 
    284  
    285     // Create indicies 
    286     add_clean_index($wpdb->posts, 'post_name'); 
    287     add_clean_index($wpdb->categories, 'category_nicename'); 
    288     add_clean_index($wpdb->comments, 'comment_approved'); 
    28914 
    29015    // Get the title and ID of every post, post_name to check if it already has a value 
     
    31136                                                      WHERE option_name LIKE 'links_rating_image%' 
    31237                                                      AND option_value LIKE 'wp-links/links-images/%'"); 
    313  
    314     // Multiple categories 
    315     maybe_create_table($wpdb->post2cat, " 
    316         CREATE TABLE `$wpdb->post2cat` ( 
    317         `rel_id` INT NOT NULL AUTO_INCREMENT , 
    318         `post_id` INT NOT NULL , 
    319         `category_id` INT NOT NULL , 
    320         PRIMARY KEY ( `rel_id` ) , 
    321         INDEX ( `post_id` , `category_id` ) 
    322         ) 
    323         "); 
    32438 
    32539    $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat"); 
     
    35367    global $wpdb; 
    35468 
    355     // Less intrusive default 
    356     $wpdb->query("ALTER TABLE `$wpdb->linkcategories` CHANGE `show_description` `show_description` ENUM( 'Y', 'N' ) DEFAULT 'N' NOT NULL");  
    357      
    35869    // Clean up indices, add a few 
    35970    add_clean_index($wpdb->posts, 'post_name'); 
     
    37081  global $wpdb; 
    37182     
    372     maybe_add_column($wpdb->comments, 'user_id', "ALTER TABLE `$wpdb->comments` ADD `user_id` INT DEFAULT '0' NOT NULL ;"); 
    373     maybe_add_column($wpdb->users, 'user_activation_key', "ALTER TABLE `$wpdb->users` ADD `user_activation_key` VARCHAR( 60 ) NOT NULL ;"); 
    374     maybe_add_column($wpdb->users, 'user_status', "ALTER TABLE `$wpdb->users` ADD `user_status` INT DEFAULT '0' NOT NULL ;"); 
    375     $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `comment_status` `comment_status` ENUM( 'open', 'closed', 'registered_only' ) DEFAULT 'open' NOT NULL"); 
    376  
    377     maybe_add_column($wpdb->users, 'user_nicename', "ALTER TABLE `$wpdb->users` ADD `user_nicename` VARCHAR(50) DEFAULT '' NOT NULL ;"); 
    378     maybe_add_column($wpdb->posts, 'post_date_gmt', "ALTER TABLE $wpdb->posts ADD post_date_gmt DATETIME NOT NULL AFTER post_date"); 
    379     maybe_add_column($wpdb->posts, 'post_modified_gmt', "ALTER TABLE $wpdb->posts ADD post_modified_gmt DATETIME NOT NULL AFTER post_modified"); 
    380     maybe_add_column($wpdb->comments, 'comment_date_gmt', "ALTER TABLE $wpdb->comments ADD comment_date_gmt DATETIME NOT NULL AFTER comment_date"); 
    381  
    38283    // Set user_nicename. 
    38384    $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); 
     
    437138    } 
    438139 
    439     // post-meta 
    440     maybe_create_table($wpdb->postmeta, " 
    441     CREATE TABLE $wpdb->postmeta ( 
    442       meta_id int(11) NOT NULL auto_increment, 
    443       post_id int(11) NOT NULL default 0, 
    444       meta_key varchar(255), 
    445       meta_value text, 
    446       PRIMARY KEY (meta_id), 
    447       INDEX (post_id), 
    448       INDEX (meta_key) 
    449     ) 
    450     "); 
    451  
    452140    // First we need to enlarge option_value so it can hold larger values: 
    453141    $wpdb->query("ALTER TABLE `$wpdb->options` CHANGE `option_value` `option_value` TEXT NOT NULL"); 
    454142 
    455     // Fix for CVS versions 
    456     $wpdb->query("UPDATE $wpdb->options SET option_type = '5' WHERE option_name = 'advanced_edit'"); 
    457  
    458     // Forward-thinking 
    459     $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL"); 
    460     maybe_add_column($wpdb->posts, 'post_parent', "ALTER TABLE `$wpdb->posts` ADD `post_parent` INT NOT NULL ;"); 
    461  
    462  
    463143    $wpdb->query("ALTER TABLE `$wpdb->comments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL"); 
    464144} 
     
    466146function upgrade_130() { 
    467147    global $wpdb, $table_prefix; 
    468  
    469     add_option('default_email_category', 1, 'Posts by email go to this category'); 
    470     add_option('recently_edited'); 
    471     add_option('use_linksupdate', 0); 
    472  
    473     maybe_add_column($wpdb->options, 'autoload', "ALTER TABLE `$wpdb->options` ADD `autoload` ENUM( 'yes', 'no' ) NOT NULL ;"); 
    474  
    475     // Set up a few options not to load by default 
    476     $fatoptions = array( 'moderation_keys', 'recently_edited' ); 
    477     foreach ($fatoptions as $fatoption) : 
    478         $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); 
    479     endforeach; 
    480148 
    481149    // Remove extraneous backslashes. 
     
    837505} 
    838506 
    839 function rename_field($table, $field, $new) { 
    840 //  ALTER TABLE `wp_users` CHANGE `ID` `user_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT  
    841 } 
    842  
    843 function remove_field($table, $field) { 
    844     global $wpdb; 
    845 // ALTER TABLE `wp_users` DROP `user_domain`  
     507function make_db_current_silent() { 
     508    global $wp_queries; 
     509 
     510    $alterations = dbDelta($wp_queries); 
    846511} 
    847512 
  • trunk/wp-admin/upgrade.php

    r1575 r1601  
    1212<html xmlns="http://www.w3.org/1999/xhtml"> 
    1313<head> 
    14 <title>WordPress &rsaquo; Upgrade WordPress</title> 
    15 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    16 <style media="screen" type="text/css"> 
     14    <title>WordPress &rsaquo; Upgrade</title> 
     15    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     16    <style media="screen" type="text/css"> 
     17    <!-- 
     18    html { 
     19        background: #eee; 
     20    } 
    1721    body { 
    18         background-color: white; 
    19         color: black; 
     22        background: #fff; 
     23        color: #000; 
    2024        font-family: Georgia, "Times New Roman", Times, serif; 
    21         margin-left: 15%; 
    22         margin-right: 15%; 
     25        margin-left: 20%; 
     26        margin-right: 20%; 
     27        padding: .2em 2em; 
     28    } 
     29     
     30    h1 { 
     31        color: #006; 
     32        font-size: 18px; 
     33        font-weight: lighter; 
     34    } 
     35     
     36    h2 { 
     37        font-size: 16px; 
     38    } 
     39     
     40    p, li, dt { 
     41        line-height: 140%; 
     42        padding-bottom: 2px; 
     43    } 
     44 
     45    ul, ol { 
     46        padding: 5px 5px 5px 20px; 
    2347    } 
    2448    #logo { 
    25         margin: 0; 
    26         padding: 0; 
    27         background-image: url(http://wordpress.org/images/logo.png); 
    28         background-repeat: no-repeat; 
    29         height: 60px; 
    30         border-bottom: 4px solid #333; 
     49        margin-bottom: 2em; 
    3150    } 
    32     #logo a { 
    33         display: block; 
    34         text-decoration: none; 
    35         text-indent: -100em; 
    36         height: 60px; 
    37     } 
    38     p { 
    39         line-height: 140%; 
    40     } 
     51.step a, .step input { 
     52    font-size: 2em; 
     53} 
     54.step, th { 
     55    text-align: right; 
     56} 
     57#footer { 
     58text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: italic; 
     59} 
     60    --> 
    4161    </style> 
    42 </head><body>  
    43 <h1 id="logo"><a href="http://wordpress.org">WordPress</a></h1>  
     62</head> 
     63<body> 
     64<h1 id="logo"><img alt="WordPress" src="http://static.wordpress.org/logo.png" /></h1> 
    4465<?php 
    4566switch($step) { 
     
    4768    case 0: 
    4869?>  
    49 <p>This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient. </p>  
    50 <p>If you&#8217;re all ready, <a href="upgrade.php?step=1">let's go</a>! </p>  
     70<p>This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.</p>  
     71<h2 class="step"><a href="upgrade.php?step=1">Upgrade WordPress &raquo;</a></h2> 
    5172<?php 
    5273    break; 
    5374     
    5475    case 1: 
     76    make_db_current_silent(); 
    5577    upgrade_all(); 
    5678?>  
  • trunk/wp-includes/functions.php

    r1599 r1601  
    365365        $value = serialize($value); 
    366366 
    367     if(!get_settings($name)) { 
     367    if( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$name'") ) { 
    368368        $name = $wpdb->escape($name); 
    369369        $value = $wpdb->escape($value); 
Note: See TracChangeset for help on using the changeset viewer.