diff --git a/wp-admin/install.php b/wp-admin/install.php index 32b886b63e..ccb8a3e8a0 100644 --- a/wp-admin/install.php +++ b/wp-admin/install.php @@ -4,7 +4,7 @@ if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. I need this before we can get started. Need more help? We got it. You can create a wp-config.php file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file."); require_once('../wp-config.php'); -require('upgrade-functions.php'); +require('./upgrade-functions.php'); $guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $HTTP_HOST . $REQUEST_URI); @@ -68,7 +68,6 @@ text-align: center; border-top: 1px solid #ccc; padding-top: 1em; font-style: it

WordPress

hide_errors(); $installed = $wpdb->get_results("SELECT * FROM $wpdb->users"); @@ -89,7 +88,7 @@ switch($step) {

First Step

Before we begin we need a little bit of information. Don't worry, you can always change these later.

-
+ @@ -109,391 +108,46 @@ switch($step) {

Second Step

Now we’re going to create the database tables and fill them with some default data.

- -links) - $got_links = true; - if ($row[0] == $wpdb->linkcategories) - $got_cats = true; - //print "Table: $row[0]
\n"; -} -if (!$got_cats) { - $sql = "CREATE TABLE $wpdb->linkcategories ( " . - " cat_id int(11) NOT NULL auto_increment, " . - " cat_name tinytext NOT NULL, ". - " auto_toggle enum ('Y','N') NOT NULL default 'N', ". - " show_images enum ('Y','N') NOT NULL default 'Y', " . - " show_description enum ('Y','N') NOT NULL default 'Y', " . - " show_rating enum ('Y','N') NOT NULL default 'Y', " . - " show_updated enum ('Y','N') NOT NULL default 'Y', " . - " sort_order varchar(64) NOT NULL default 'name', " . - " sort_desc enum('Y','N') NOT NULL default 'N', " . - " text_before_link varchar(128) not null default '
  • ', " . - " text_after_link varchar(128) not null default '
    '," . - " text_after_all varchar(128) not null default '
  • ', " . - " list_limit int not null default '-1', " . - " PRIMARY KEY (cat_id) ". - ") "; - $result = mysql_query($sql) or print ("Can't create the table '$wpdb->linkcategories' in the database.
    " . $sql . "
    " . mysql_error()); - if ($result != false) { - $got_cats = true; - } -} else { - $got_cats = true; -} -if (!$got_links) { - $sql = "CREATE TABLE $wpdb->links ( " . - " link_id int(11) NOT NULL auto_increment, " . - " link_url varchar(255) NOT NULL default '', " . - " link_name varchar(255) NOT NULL default '', " . - " link_image varchar(255) NOT NULL default '', " . - " link_target varchar(25) NOT NULL default '', " . - " link_category int(11) NOT NULL default 0, " . - " link_description varchar(255) NOT NULL default '', " . - " link_visible enum ('Y','N') NOT NULL default 'Y', " . - " link_owner int NOT NULL DEFAULT '1', " . - " link_rating int NOT NULL DEFAULT '0', " . - " link_updated DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', " . - " link_rel varchar(255) NOT NULL default '', " . - " link_notes MEDIUMTEXT NOT NULL default '', " . - " PRIMARY KEY (link_id) " . - ") "; - $result = mysql_query($sql) or print ("Can't create the table '$wpdb->links' in the database.
    " . $sql . "
    " . mysql_error()); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://wordpress.org/', 'WordPress', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://photomatt.net/', 'Matt', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://zed1.com/journalized/', 'Mike', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://www.alexking.org/', 'Alex', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); - $links = mysql_query("INSERT INTO $wpdb->links VALUES ('', 'http://dougal.gunters.org/', 'Dougal', '', '', 1, '', 'Y', 1, 0, '0000-00-00 00:00:00', '', '');"); - - - if ($result != false) { - $got_links = true; - } -} else { - $got_links = true; -} - -if ($got_links && $got_cats) { - $sql = "SELECT * FROM $wpdb->linkcategories WHERE cat_id=1 "; - $result = mysql_query($sql) or print ("Can't query '$wpdb->linkcategories'.
    " . $sql . "
    " . mysql_error()); - if ($result != false) { - if ($row = mysql_fetch_object($result)) { - $got_row = true; - } else { - $sql = "INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Links')"; - $result = mysql_query($sql) or print ("Can't query insert category.
    " . $sql . "
    " . mysql_error()); - if ($result != false) { - $got_row = true; - } - } - } -} - -?> -posts"; -// $q = mysql_query($query) or die ("doh, can't drop the table \"$wpdb->posts\" in the database."); - -$query = "CREATE TABLE $wpdb->posts ( - ID int(10) unsigned NOT NULL auto_increment, - post_author int(4) NOT NULL default '0', - post_date datetime NOT NULL default '0000-00-00 00:00:00', - post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content text NOT NULL, - post_title text NOT NULL, - post_category int(4) NOT NULL default '0', - post_excerpt text NOT NULL, - post_lat float, - post_lon float, - post_status enum('publish','draft','private') NOT NULL default 'publish', - comment_status enum('open','closed') NOT NULL default 'open', - ping_status enum('open','closed') NOT NULL default 'open', - post_password varchar(20) NOT NULL default '', - post_name varchar(200) NOT NULL default '', - to_ping text NOT NULL, - pinged text NOT NULL, - post_modified datetime NOT NULL default '0000-00-00 00:00:00', - post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content_filtered text NOT NULL, - PRIMARY KEY (ID), - KEY post_date (post_date), - KEY post_date_gmt (post_date_gmt), - KEY post_name (post_name), - KEY post_status (post_status) -) -"; -$q = $wpdb->query($query); -?> query("UPDATE $wpdb->options SET option_value = '$weblog_title' WHERE option_name = 'blogname'"); +$wpdb->query("UPDATE $wpdb->options SET option_value = '$admin_email' WHERE option_name = 'admin_email'"); + +// Now drop in some default links +$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, 'Blogroll')"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://photomatt.net/', 'Matt', 1);"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://zed1.com/journalized/', 'Mike', 1);"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://www.alexking.org/', 'Alex', 1);"); +$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category) VALUES ('http://dougal.gunters.org/', 'Dougal', 1);"); + +// Default category +$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'Uncategorized')"); + +// First post $now = date('Y-m-d H:i:s'); $now_gmt = gmdate('Y-m-d H:i:s'); -$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')"; +$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')"); -$q = $wpdb->query($query); -?> +// Default comment +$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.
    To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')"); -categories"; -// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->categories\" in the database."); - -$query = " -CREATE TABLE $wpdb->categories ( - cat_ID int(4) NOT NULL auto_increment, - cat_name varchar(55) NOT NULL default '', - PRIMARY KEY (cat_ID), - UNIQUE (cat_name) -) -"; -$q = $wpdb->query($query); - -$query = "INSERT INTO $wpdb->categories (cat_ID, cat_name) VALUES ('0', 'General')"; -$q = $wpdb->query($query); - -$query = "UPDATE $wpdb->posts SET post_category = 1"; -$result = $wpdb->query($query); -?> - -comments"; -// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->comments\" in the database."); - -$query = " -CREATE TABLE $wpdb->comments ( - comment_ID int(11) unsigned NOT NULL auto_increment, - comment_post_ID int(11) NOT NULL default '0', - comment_author tinytext NOT NULL, - comment_author_email varchar(100) NOT NULL default '', - comment_author_url varchar(100) NOT NULL default '', - comment_author_IP varchar(100) NOT NULL default '', - comment_date datetime NOT NULL default '0000-00-00 00:00:00', - comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - comment_content text NOT NULL, - comment_karma int(11) NOT NULL default '0', - PRIMARY KEY (comment_ID) -) -"; -$q = $wpdb->query($query); - -$now = date('Y-m-d H:i:s'); -$now_gmt = gmdate('Y-m-d H:i:s'); -$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.
    To delete a comment, just log in, and view the posts\' comments, there you will have the option to edit or delete them.')"; -$q = $wpdb->query($query); -?> - -postmeta ( - meta_id int(11) NOT NULL auto_increment, - post_id int(11) NOT NULL default 0, - meta_key varchar(255), - meta_value text, - PRIMARY KEY (meta_id), - INDEX (post_id), - INDEX (meta_key) - ) - "; - -$q = $wpdb->query($query); - - -?> - -options"; -// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->options\" in the database."); - -$query = " -CREATE TABLE $wpdb->options ( - option_id int(11) 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 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, option_name) -) -"; -$q = $wpdb->query($query); - -$option_data = array( -//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(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(3,'blogname', 3, '$weblog_title', 'blogname is the name of your blog', 8, 20)", -"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)", -//"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)", -"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)", -"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)", -"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)", -"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’s charset (here’s a list of possible charsets)', 8)", -// general blog setup -"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)", -//"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -//rss/rdf feeds -"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)", -"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)", -"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 <description> tag?', 8, 20)", -"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)", -"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)", -"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)", -"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)", -//file upload -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -// email settings -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -// original options from options page -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", - -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", - -); - -foreach ($option_data as $query) { - $q = $wpdb->query($query); -} -?> - - - -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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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)", -"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, '>>', 'The text to prepend to a recently updated link', 8, 10)", -"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, '<<', 'The text to append to a recently updated link', 8, 20)", -"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)", -); - -foreach ($links_option_data as $query) { - $q = $wpdb->query($query); -} -?> - - -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)", -"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)", -"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 - see here', 8, 20)", -"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)", -); - -foreach ($geo_option_data as $query) { - $q = $wpdb->query($query); -} -?> - -

    Groovy. We're almost done.

    - -

    Third Step

    -users"; -// $q = mysql_query($query) or mysql_doh("doh, can't drop the table \"$wpdb->users\" in the database."); - -$query = " -CREATE TABLE $wpdb->users ( - ID int(10) unsigned NOT NULL auto_increment, - user_login varchar(20) NOT NULL default '', - user_pass varchar(64) NOT NULL default '', - user_firstname varchar(50) NOT NULL default '', - user_lastname varchar(50) NOT NULL default '', - user_nickname varchar(50) NOT NULL default '', - user_icq int(10) unsigned NOT NULL default '0', - user_email varchar(100) NOT NULL default '', - user_url varchar(100) NOT NULL default '', - user_ip varchar(15) NOT NULL default '', - user_domain varchar(200) NOT NULL default '', - user_browser varchar(200) NOT NULL default '', - dateYMDhour datetime NOT NULL default '0000-00-00 00:00:00', - user_level int(2) unsigned NOT NULL default '0', - user_aim varchar(50) NOT NULL default '', - user_msn varchar(100) NOT NULL default '', - user_yim varchar(50) NOT NULL default '', - user_idmode varchar(20) NOT NULL default '', - PRIMARY KEY (ID), - UNIQUE KEY (user_login) -) -"; -$q = $wpdb->query($query); - -$random_password = substr(md5(uniqid(microtime())),0,6); - -$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')"; -$q = $wpdb->query($query); - -// Do final updates -upgrade_all(); +// Set up admin user +$random_password = substr(md5(uniqid(microtime())), 0, 6); +$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')"); mail($admin_email, 'New WordPress Blog', "Your new WordPress blog has been sucessfully set up at: @@ -509,9 +163,11 @@ We hope you enjoy your new weblog. Thanks! --The WordPress Team http://wordpress.org/ "); + +upgrade_all(); ?> -

    User setup successful!

    +

    Finished!

    Now you can log in with the login "admin" and password "".

    @@ -524,8 +180,10 @@ http://wordpress.org/
    admin
    Password
    +
    Login address
    +
    wp-login.php
    -

    Were you expecting more steps? Sorry to disappoint. All done!

    +

    Were you expecting more steps? Sorry to disappoint. All done! :)

    categories ( - cat_ID int(4) NOT NULL auto_increment, - cat_name varchar(55) NOT NULL default '', - category_nicename varchar(200) NOT NULL default '', - category_description text NOT NULL, - category_parent int(4) NOT NULL default '0', - PRIMARY KEY (cat_ID), - UNIQUE KEY cat_name (cat_name), - KEY category_nicename (category_nicename) -); -CREATE TABLE $wpdb->comments ( - comment_ID int(11) unsigned NOT NULL auto_increment, - comment_post_ID int(11) NOT NULL default '0', - comment_author tinytext NOT NULL, - comment_author_email varchar(100) NOT NULL default '', - comment_author_url varchar(200) NOT NULL default '', - comment_author_IP varchar(100) NOT NULL default '', - comment_date datetime NOT NULL default '0000-00-00 00:00:00', - comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - comment_content text NOT NULL, - comment_karma int(11) NOT NULL default '0', - comment_approved enum('0','1') NOT NULL default '1', - user_id int(11) NOT NULL default '0', - PRIMARY KEY (comment_ID), - KEY comment_approved (comment_approved), - KEY comment_post_ID (comment_post_ID) -); -CREATE TABLE $wpdb->linkcategories ( - cat_id int(11) NOT NULL auto_increment, - cat_name tinytext NOT NULL, - auto_toggle enum('Y','N') NOT NULL default 'N', - show_images enum('Y','N') NOT NULL default 'Y', - show_description enum('Y','N') NOT NULL default 'N', - show_rating enum('Y','N') NOT NULL default 'Y', - show_updated enum('Y','N') NOT NULL default 'Y', - sort_order varchar(64) NOT NULL default 'name', - sort_desc enum('Y','N') NOT NULL default 'N', - text_before_link varchar(128) NOT NULL default '
  • ', - text_after_link varchar(128) NOT NULL default '
    ', - text_after_all varchar(128) NOT NULL default '
  • ', - list_limit int(11) NOT NULL default '-1', - PRIMARY KEY (cat_id) -); -CREATE TABLE $wpdb->links ( - link_id int(11) NOT NULL auto_increment, - link_url varchar(255) NOT NULL default '', - link_name varchar(255) NOT NULL default '', - link_image varchar(255) NOT NULL default '', - link_target varchar(25) NOT NULL default '', - link_category int(11) NOT NULL default '0', - link_description varchar(255) NOT NULL default '', - link_visible enum('Y','N') NOT NULL default 'Y', - link_owner int(11) NOT NULL default '1', - link_rating int(11) NOT NULL default '0', - link_updated datetime NOT NULL default '0000-00-00 00:00:00', - link_rel varchar(255) NOT NULL default '', - link_notes mediumtext NOT NULL, - link_rss varchar(255) NOT NULL default '', - PRIMARY KEY (link_id), - KEY link_category (link_category), - KEY link_visible (link_visible) -); -CREATE TABLE $wpdb->options ( - option_id int(11) 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 text 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) -); -CREATE TABLE $wpdb->post2cat ( - rel_id int(11) NOT NULL auto_increment, - post_id int(11) NOT NULL default '0', - category_id int(11) NOT NULL default '0', - PRIMARY KEY (rel_id), - KEY post_id (post_id,category_id) -); -CREATE TABLE $wpdb->postmeta ( - meta_id int(11) NOT NULL auto_increment, - post_id int(11) NOT NULL default '0', - meta_key varchar(255) default NULL, - meta_value text, - PRIMARY KEY (meta_id), - KEY post_id (post_id), - KEY meta_key (meta_key) -); -CREATE TABLE $wpdb->posts ( - ID int(10) unsigned NOT NULL auto_increment, - post_author int(4) NOT NULL default '0', - post_date datetime NOT NULL default '0000-00-00 00:00:00', - post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content text NOT NULL, - post_title text NOT NULL, - post_category int(4) NOT NULL default '0', - post_excerpt text NOT NULL, - post_lat float default NULL, - post_lon float default NULL, - post_status enum('publish','draft','private','static') NOT NULL default 'publish', - comment_status enum('open','closed','registered_only') NOT NULL default 'open', - ping_status enum('open','closed') NOT NULL default 'open', - post_password varchar(20) NOT NULL default '', - post_name varchar(200) NOT NULL default '', - to_ping text NOT NULL, - pinged text NOT NULL, - post_modified datetime NOT NULL default '0000-00-00 00:00:00', - post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', - post_content_filtered text NOT NULL, - post_parent int(11) NOT NULL default '0', - PRIMARY KEY (ID), - KEY post_date (post_date), - KEY post_date_gmt (post_date_gmt), - KEY post_name (post_name), - KEY post_status (post_status) -); -CREATE TABLE $wpdb->users ( - ID int(10) unsigned NOT NULL auto_increment, - user_login varchar(20) NOT NULL default '', - user_pass varchar(64) NOT NULL default '', - user_firstname varchar(50) NOT NULL default '', - user_lastname varchar(50) NOT NULL default '', - user_nickname varchar(50) NOT NULL default '', - user_nicename varchar(50) NOT NULL default '', - user_icq int(10) unsigned NOT NULL default '0', - user_email varchar(100) NOT NULL default '', - user_url varchar(100) NOT NULL default '', - user_ip varchar(15) NOT NULL default '', - user_domain varchar(200) NOT NULL default '', - user_browser varchar(200) NOT NULL default '', - dateYMDhour datetime NOT NULL default '0000-00-00 00:00:00', - user_level int(2) unsigned NOT NULL default '0', - user_aim varchar(50) NOT NULL default '', - user_msn varchar(100) NOT NULL default '', - user_yim varchar(50) NOT NULL default '', - user_idmode varchar(20) NOT NULL default '', - user_activation_key varchar(60) NOT NULL default '', - user_status int(11) NOT NULL default '0', - PRIMARY KEY (ID), - UNIQUE KEY user_login (user_login) -);"; - - - function upgrade_all() { populate_options(); - upgrade_071(); - upgrade_072(); upgrade_100(); upgrade_101(); upgrade_110(); upgrade_130(); } -function populate_options() { - - $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); - add_option('siteurl', $guessurl, 'WordPress web address'); - add_option('blogfilename', '', 'Default file for blog'); - add_option('blogname', 'My Weblog', 'Blog title'); - add_option('blogdescription', '', 'Short tagline'); - add_option('new_users_can_blog', 0); - add_option('users_can_register', 1); - add_option('admin_email', 'you@example.com'); - add_option('start_of_week', 1); - add_option('use_balanceTags', 1); - add_option('use_smilies', 1); - add_option('require_name_email', 1); - add_option('comments_notify', 1); - add_option('posts_per_rss', 10); - add_option('rss_excerpt_length', 50); - add_option('rss_use_excerpt', 0); - add_option('use_fileupload', 0); - add_option('fileupload_realpath', ABSPATH . 'wp-content'); - add_option('fileupload_url', get_option('siteurl') . '/wp-content'); - add_option('fileupload_allowedtypes', 'jpg jpeg gif png'); - add_option('fileupload_maxk', 300); - add_option('fileupload_minlevel', 6); - add_option('mailserver_url', 'mail.example.com'); - add_option('mailserver_login', 'login@example.com'); - add_option('mailserver_pass', 'password'); - add_option('mailserver_port', 110); - add_option('default_category', 1); - add_option('default_comment_status', 'open'); - add_option('default_ping_status', 'open'); - add_option('default_pingback_flag', 1); - add_option('default_post_edit_rows', 9); - add_option('posts_per_page', 10); - add_option('what_to_show', 'posts'); - add_option('date_format', 'F j, Y'); - add_option('time_format', 'g:i a'); - add_option('use_geo_positions', 0); - add_option('use_default_geourl', 0); - add_option('default_geourl_lat', 0); - add_option('default_geourl_lon', 0); - add_option('weblogs_xml_url', 'http://static.wordpress.org/changes.xml'); - add_option('links_updated_date_format', 'F j, Y g:i a'); - add_option('links_recently_updated_prepend', ''); - add_option('links_recently_updated_append', ''); - add_option('links_recently_updated_time', 120); - add_option('comment_moderation', 0); - add_option('moderation_notify', 1); - add_option('permalink_structure'); - add_option('gzipcompression', 0); - add_option('hack_file', 0); - add_option('blog_charset', 'utf-8'); - add_option('moderation_keys'); - add_option('active_plugins'); - add_option('home'); - add_option('category_base'); - add_option('ping_sites', 'http://rpc.pingomatic.com/'); - add_option('advanced_edit', 0); - add_option('comment_max_links', 2); - - // Delete unused options - $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'); - foreach ($unusedoptions as $option) : - delete_option($option); - endforeach; -} - -function upgrade_071() { - global $wpdb; - maybe_add_column($wpdb->posts, 'post_status', "ALTER TABLE $wpdb->posts ADD `post_status` ENUM('publish','draft','private') NOT NULL"); - maybe_add_column($wpdb->posts, 'comment_status', "ALTER TABLE $wpdb->posts ADD `comment_status` ENUM('open','closed') NOT NULL"); - maybe_add_column($wpdb->posts, 'ping_status', "ALTER TABLE $wpdb->posts ADD `ping_status` ENUM('open','closed') NOT NULL"); - maybe_add_column($wpdb->posts, 'post_password', "ALTER TABLE $wpdb->posts ADD post_password varchar(20) NOT NULL"); -} - -function upgrade_072() { - global $wpdb; - maybe_add_column($wpdb->links, 'link_notes', "ALTER TABLE $wpdb->links ADD COLUMN link_notes MEDIUMTEXT NOT NULL DEFAULT '' "); - maybe_add_column($wpdb->linkcategories, 'show_images', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_images enum('Y','N') NOT NULL default 'Y'"); - maybe_add_column($wpdb->linkcategories, 'show_description', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_description enum('Y','N') NOT NULL default 'Y'"); - maybe_add_column($wpdb->linkcategories, 'show_rating', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_rating enum('Y','N') NOT NULL default 'Y'"); - maybe_add_column($wpdb->linkcategories, 'show_updated', "ALTER TABLE $wpdb->linkcategories ADD COLUMN show_updated enum('Y','N') NOT NULL default 'Y'"); - maybe_add_column($wpdb->linkcategories, 'sort_order', "ALTER TABLE $wpdb->linkcategories ADD COLUMN sort_order varchar(64) NOT NULL default 'name'"); - maybe_add_column($wpdb->linkcategories, 'sort_desc', "ALTER TABLE $wpdb->linkcategories ADD COLUMN sort_desc enum('Y','N') NOT NULL default 'N'"); - maybe_add_column($wpdb->linkcategories, 'text_before_link', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_before_link varchar(128) not null default '
  • '"); - maybe_add_column($wpdb->linkcategories, 'text_after_link', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_after_link varchar(128) not null default '
    '"); - maybe_add_column($wpdb->linkcategories, 'text_after_all', "ALTER TABLE $wpdb->linkcategories ADD COLUMN text_after_all varchar(128) not null default '
  • '"); - maybe_add_column($wpdb->linkcategories, 'list_limit', "ALTER TABLE $wpdb->linkcategories ADD COLUMN list_limit int not null default -1"); - maybe_add_column($wpdb->posts, 'post_lon', "ALTER TABLE $wpdb->posts ADD COLUMN post_lon float"); - maybe_add_column($wpdb->posts, 'post_lat', "ALTER TABLE $wpdb->posts ADD COLUMN post_lat float "); - maybe_create_table($wpdb->options, " - CREATE TABLE $wpdb->options ( - option_id int(11) 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 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, option_name) - ) - "); -} - function upgrade_100() { global $wpdb; - maybe_add_column($wpdb->posts, 'post_name', "ALTER TABLE `$wpdb->posts` ADD `post_name` VARCHAR(200) NOT NULL"); - maybe_add_column($wpdb->posts, 'to_ping', "ALTER TABLE $wpdb->posts ADD `to_ping` TEXT NOT NULL"); - maybe_add_column($wpdb->posts, 'pinged', "ALTER TABLE $wpdb->posts ADD `pinged` TEXT NOT NULL"); - maybe_add_column($wpdb->posts, 'post_modified', "ALTER TABLE $wpdb->posts ADD `post_modified` DATETIME NOT NULL"); - maybe_add_column($wpdb->posts, 'post_content_filtered', "ALTER TABLE $wpdb->posts ADD `post_content_filtered` TEXT NOT NULL"); - maybe_add_column($wpdb->categories, 'category_nicename', "ALTER TABLE `$wpdb->categories` ADD `category_nicename` VARCHAR(200) NOT NULL"); - maybe_add_column($wpdb->categories, 'category_description', "ALTER TABLE `$wpdb->categories` ADD `category_description` TEXT NOT NULL"); - maybe_add_column($wpdb->categories, 'category_parent', "ALTER TABLE `$wpdb->categories` ADD `category_parent` INT(4) NOT NULL"); - maybe_add_column($wpdb->links, 'link_rss', "ALTER TABLE `$wpdb->links` ADD `link_rss` VARCHAR( 255 ) NOT NULL;"); - maybe_add_column($wpdb->users, 'user_description', "ALTER TABLE `$wpdb->users` ADD `user_description` TEXT NOT NULL"); - maybe_add_column($wpdb->comments, 'comment_approved', "ALTER TABLE $wpdb->comments ADD COLUMN comment_approved ENUM('0', '1') DEFAULT '1' NOT NULL"); - - // Create indicies - add_clean_index($wpdb->posts, 'post_name'); - add_clean_index($wpdb->categories, 'category_nicename'); - add_clean_index($wpdb->comments, 'comment_approved'); // Get the title and ID of every post, post_name to check if it already has a value $posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''"); @@ -311,17 +36,6 @@ function upgrade_100() { WHERE option_name LIKE 'links_rating_image%' AND option_value LIKE 'wp-links/links-images/%'"); - // Multiple categories - maybe_create_table($wpdb->post2cat, " - CREATE TABLE `$wpdb->post2cat` ( - `rel_id` INT NOT NULL AUTO_INCREMENT , - `post_id` INT NOT NULL , - `category_id` INT NOT NULL , - PRIMARY KEY ( `rel_id` ) , - INDEX ( `post_id` , `category_id` ) - ) - "); - $done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat"); if ($done_ids) : foreach ($done_ids as $done_id) : @@ -352,9 +66,6 @@ function upgrade_100() { function upgrade_101() { global $wpdb; - // Less intrusive default - $wpdb->query("ALTER TABLE `$wpdb->linkcategories` CHANGE `show_description` `show_description` ENUM( 'Y', 'N' ) DEFAULT 'N' NOT NULL"); - // Clean up indices, add a few add_clean_index($wpdb->posts, 'post_name'); add_clean_index($wpdb->posts, 'post_status'); @@ -369,16 +80,6 @@ function upgrade_101() { function upgrade_110() { global $wpdb; - maybe_add_column($wpdb->comments, 'user_id', "ALTER TABLE `$wpdb->comments` ADD `user_id` INT DEFAULT '0' NOT NULL ;"); - maybe_add_column($wpdb->users, 'user_activation_key', "ALTER TABLE `$wpdb->users` ADD `user_activation_key` VARCHAR( 60 ) NOT NULL ;"); - maybe_add_column($wpdb->users, 'user_status', "ALTER TABLE `$wpdb->users` ADD `user_status` INT DEFAULT '0' NOT NULL ;"); - $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `comment_status` `comment_status` ENUM( 'open', 'closed', 'registered_only' ) DEFAULT 'open' NOT NULL"); - - maybe_add_column($wpdb->users, 'user_nicename', "ALTER TABLE `$wpdb->users` ADD `user_nicename` VARCHAR(50) DEFAULT '' NOT NULL ;"); - maybe_add_column($wpdb->posts, 'post_date_gmt', "ALTER TABLE $wpdb->posts ADD post_date_gmt DATETIME NOT NULL AFTER post_date"); - maybe_add_column($wpdb->posts, 'post_modified_gmt', "ALTER TABLE $wpdb->posts ADD post_modified_gmt DATETIME NOT NULL AFTER post_modified"); - maybe_add_column($wpdb->comments, 'comment_date_gmt', "ALTER TABLE $wpdb->comments ADD comment_date_gmt DATETIME NOT NULL AFTER comment_date"); - // Set user_nicename. $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); foreach ($users as $user) { @@ -436,48 +137,15 @@ function upgrade_110() { $wpdb->query("UPDATE $wpdb->users SET dateYMDhour = DATE_ADD(dateYMDhour, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"); } - // post-meta - maybe_create_table($wpdb->postmeta, " - CREATE TABLE $wpdb->postmeta ( - meta_id int(11) NOT NULL auto_increment, - post_id int(11) NOT NULL default 0, - meta_key varchar(255), - meta_value text, - PRIMARY KEY (meta_id), - INDEX (post_id), - INDEX (meta_key) - ) - "); - // First we need to enlarge option_value so it can hold larger values: $wpdb->query("ALTER TABLE `$wpdb->options` CHANGE `option_value` `option_value` TEXT NOT NULL"); - // Fix for CVS versions - $wpdb->query("UPDATE $wpdb->options SET option_type = '5' WHERE option_name = 'advanced_edit'"); - - // Forward-thinking - $wpdb->query("ALTER TABLE `$wpdb->posts` CHANGE `post_status` `post_status` ENUM( 'publish', 'draft', 'private', 'static' ) DEFAULT 'publish' NOT NULL"); - maybe_add_column($wpdb->posts, 'post_parent', "ALTER TABLE `$wpdb->posts` ADD `post_parent` INT NOT NULL ;"); - - $wpdb->query("ALTER TABLE `$wpdb->comments` CHANGE `comment_author_url` `comment_author_url` VARCHAR( 200 ) NOT NULL"); } function upgrade_130() { global $wpdb, $table_prefix; - add_option('default_email_category', 1, 'Posts by email go to this category'); - add_option('recently_edited'); - add_option('use_linksupdate', 0); - - maybe_add_column($wpdb->options, 'autoload', "ALTER TABLE `$wpdb->options` ADD `autoload` ENUM( 'yes', 'no' ) NOT NULL ;"); - - // Set up a few options not to load by default - $fatoptions = array( 'moderation_keys', 'recently_edited' ); - foreach ($fatoptions as $fatoption) : - $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); - endforeach; - // Remove extraneous backslashes. $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt FROM $wpdb->posts"); if ($posts) { @@ -836,13 +504,10 @@ function make_db_current() { echo "\n"; } -function rename_field($table, $field, $new) { -// ALTER TABLE `wp_users` CHANGE `ID` `user_id` INT( 10 ) UNSIGNED NOT NULL AUTO_INCREMENT -} +function make_db_current_silent() { + global $wp_queries; -function remove_field($table, $field) { - global $wpdb; -// ALTER TABLE `wp_users` DROP `user_domain` + $alterations = dbDelta($wp_queries); } ?> \ No newline at end of file diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php new file mode 100644 index 0000000000..d39af9b9bc --- /dev/null +++ b/wp-admin/upgrade-schema.php @@ -0,0 +1,226 @@ +categories ( + cat_ID int(4) NOT NULL auto_increment, + cat_name varchar(55) NOT NULL default '', + category_nicename varchar(200) NOT NULL default '', + category_description text NOT NULL, + category_parent int(4) NOT NULL default '0', + PRIMARY KEY (cat_ID), + UNIQUE KEY cat_name (cat_name), + KEY category_nicename (category_nicename) +); +CREATE TABLE $wpdb->comments ( + comment_ID int(11) unsigned NOT NULL auto_increment, + comment_post_ID int(11) NOT NULL default '0', + comment_author tinytext NOT NULL, + comment_author_email varchar(100) NOT NULL default '', + comment_author_url varchar(200) NOT NULL default '', + comment_author_IP varchar(100) NOT NULL default '', + comment_date datetime NOT NULL default '0000-00-00 00:00:00', + comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', + comment_content text NOT NULL, + comment_karma int(11) NOT NULL default '0', + comment_approved enum('0','1') NOT NULL default '1', + user_id int(11) NOT NULL default '0', + PRIMARY KEY (comment_ID), + KEY comment_approved (comment_approved), + KEY comment_post_ID (comment_post_ID) +); +CREATE TABLE $wpdb->linkcategories ( + cat_id int(11) NOT NULL auto_increment, + cat_name tinytext NOT NULL, + auto_toggle enum('Y','N') NOT NULL default 'N', + show_images enum('Y','N') NOT NULL default 'Y', + show_description enum('Y','N') NOT NULL default 'N', + show_rating enum('Y','N') NOT NULL default 'Y', + show_updated enum('Y','N') NOT NULL default 'Y', + sort_order varchar(64) NOT NULL default 'rand', + sort_desc enum('Y','N') NOT NULL default 'N', + text_before_link varchar(128) NOT NULL default '
  • ', + text_after_link varchar(128) NOT NULL default '
    ', + text_after_all varchar(128) NOT NULL default '
  • ', + list_limit int(11) NOT NULL default '-1', + PRIMARY KEY (cat_id) +); +CREATE TABLE $wpdb->links ( + link_id int(11) NOT NULL auto_increment, + link_url varchar(255) NOT NULL default '', + link_name varchar(255) NOT NULL default '', + link_image varchar(255) NOT NULL default '', + link_target varchar(25) NOT NULL default '', + link_category int(11) NOT NULL default '0', + link_description varchar(255) NOT NULL default '', + link_visible enum('Y','N') NOT NULL default 'Y', + link_owner int(11) NOT NULL default '1', + link_rating int(11) NOT NULL default '0', + link_updated datetime NOT NULL default '0000-00-00 00:00:00', + link_rel varchar(255) NOT NULL default '', + link_notes mediumtext NOT NULL, + link_rss varchar(255) NOT NULL default '', + PRIMARY KEY (link_id), + KEY link_category (link_category), + KEY link_visible (link_visible) +); +CREATE TABLE $wpdb->options ( + option_id int(11) 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 text 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) +); +CREATE TABLE $wpdb->post2cat ( + rel_id int(11) NOT NULL auto_increment, + post_id int(11) NOT NULL default '0', + category_id int(11) NOT NULL default '0', + PRIMARY KEY (rel_id), + KEY post_id (post_id,category_id) +); +CREATE TABLE $wpdb->postmeta ( + meta_id int(11) NOT NULL auto_increment, + post_id int(11) NOT NULL default '0', + meta_key varchar(255) default NULL, + meta_value text, + PRIMARY KEY (meta_id), + KEY post_id (post_id), + KEY meta_key (meta_key) +); +CREATE TABLE $wpdb->posts ( + ID int(10) unsigned NOT NULL auto_increment, + post_author int(4) NOT NULL default '0', + post_date datetime NOT NULL default '0000-00-00 00:00:00', + post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00', + post_content text NOT NULL, + post_title text NOT NULL, + post_category int(4) NOT NULL default '0', + post_excerpt text NOT NULL, + post_lat float default NULL, + post_lon float default NULL, + post_status enum('publish','draft','private','static') NOT NULL default 'publish', + comment_status enum('open','closed','registered_only') NOT NULL default 'open', + ping_status enum('open','closed') NOT NULL default 'open', + post_password varchar(20) NOT NULL default '', + post_name varchar(200) NOT NULL default '', + to_ping text NOT NULL, + pinged text NOT NULL, + post_modified datetime NOT NULL default '0000-00-00 00:00:00', + post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00', + post_content_filtered text NOT NULL, + post_parent int(11) NOT NULL default '0', + PRIMARY KEY (ID), + KEY post_date_gmt (post_date_gmt), + KEY post_name (post_name), + KEY post_status (post_status) +); +CREATE TABLE $wpdb->users ( + ID int(10) unsigned NOT NULL auto_increment, + user_login varchar(20) NOT NULL default '', + user_pass varchar(64) NOT NULL default '', + user_firstname varchar(50) NOT NULL default '', + user_lastname varchar(50) NOT NULL default '', + user_nickname varchar(50) NOT NULL default '', + user_nicename varchar(50) NOT NULL default '', + user_icq int(10) unsigned NOT NULL default '0', + user_email varchar(100) NOT NULL default '', + user_url varchar(100) NOT NULL default '', + user_ip varchar(15) NOT NULL default '', + user_domain varchar(200) NOT NULL default '', + user_browser varchar(200) NOT NULL default '', + dateYMDhour datetime NOT NULL default '0000-00-00 00:00:00', + user_level int(2) unsigned NOT NULL default '0', + user_aim varchar(50) NOT NULL default '', + user_msn varchar(100) NOT NULL default '', + user_yim varchar(50) NOT NULL default '', + user_idmode varchar(20) NOT NULL default '', + user_activation_key varchar(60) NOT NULL default '', + user_status int(11) NOT NULL default '0', + PRIMARY KEY (ID), + UNIQUE KEY user_login (user_login) +);"; + +function populate_options() { + global $wpdb; + + $guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); + add_option('siteurl', $guessurl, 'WordPress web address'); + add_option('blogfilename', '', 'Default file for blog'); + add_option('blogname', 'My Weblog', 'Blog title'); + add_option('blogdescription', 'Just another WordPress weblog', 'Short tagline'); + add_option('new_users_can_blog', 0); + add_option('users_can_register', 1); + add_option('admin_email', 'you@example.com'); + add_option('start_of_week', 1); + add_option('use_balanceTags', 1); + add_option('use_smilies', 1); + add_option('require_name_email', 1); + add_option('comments_notify', 1); + add_option('posts_per_rss', 10); + add_option('rss_excerpt_length', 50); + add_option('rss_use_excerpt', 0); + add_option('use_fileupload', 0); + add_option('fileupload_realpath', ABSPATH . 'wp-content'); + add_option('fileupload_url', get_option('siteurl') . '/wp-content'); + add_option('fileupload_allowedtypes', 'jpg jpeg gif png'); + add_option('fileupload_maxk', 300); + add_option('fileupload_minlevel', 6); + add_option('mailserver_url', 'mail.example.com'); + add_option('mailserver_login', 'login@example.com'); + add_option('mailserver_pass', 'password'); + add_option('mailserver_port', 110); + add_option('default_category', 1); + add_option('default_comment_status', 'open'); + add_option('default_ping_status', 'open'); + add_option('default_pingback_flag', 1); + add_option('default_post_edit_rows', 9); + add_option('posts_per_page', 10); + add_option('what_to_show', 'posts'); + add_option('date_format', 'F j, Y'); + add_option('time_format', 'g:i a'); + add_option('use_geo_positions', 0); + add_option('use_default_geourl', 0); + add_option('default_geourl_lat', 0); + add_option('default_geourl_lon', 0); + add_option('weblogs_xml_url', 'http://static.wordpress.org/changes.xml'); + add_option('links_updated_date_format', 'F j, Y g:i a'); + add_option('links_recently_updated_prepend', ''); + add_option('links_recently_updated_append', ''); + add_option('links_recently_updated_time', 120); + add_option('comment_moderation', 0); + add_option('moderation_notify', 1); + add_option('permalink_structure'); + add_option('gzipcompression', 0); + add_option('hack_file', 0); + add_option('blog_charset', 'utf-8'); + add_option('moderation_keys'); + add_option('active_plugins'); + add_option('home'); + add_option('category_base'); + add_option('ping_sites', 'http://rpc.pingomatic.com/'); + add_option('advanced_edit', 0); + add_option('comment_max_links', 2); + // 1.3 + add_option('default_email_category', 1, 'Posts by email go to this category'); + add_option('recently_edited'); + add_option('use_linksupdate', 0); + + // Delete unused options + $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'); + foreach ($unusedoptions as $option) : + delete_option($option); + endforeach; + + // Set up a few options not to load by default + $fatoptions = array( 'moderation_keys', 'recently_edited' ); + foreach ($fatoptions as $fatoption) : + $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); + endforeach; +} +?> \ No newline at end of file diff --git a/wp-admin/upgrade.php b/wp-admin/upgrade.php index 248ea315b4..d25c0fb9de 100644 --- a/wp-admin/upgrade.php +++ b/wp-admin/upgrade.php @@ -11,47 +11,69 @@ if (!$step) $step = 0; -WordPress › Upgrade WordPress - - - -

    WordPress

    + + +

    WordPress

    -

    This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.

    -

    If you’re all ready, let's go!

    +

    This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.

    +

    Upgrade WordPress »

    Step 1

    diff --git a/wp-includes/functions.php b/wp-includes/functions.php index e212591b6d..68266944b6 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -364,7 +364,7 @@ function add_option($name, $value = '', $description = '') { if ( is_array($value) || is_object($value) ) $value = serialize($value); - if(!get_settings($name)) { + if( !$wpdb->get_var("SELECT option_name FROM $wpdb->options WHERE option_name = '$name'") ) { $name = $wpdb->escape($name); $value = $wpdb->escape($value); $description = $wpdb->escape($description);
    Weblog title: