]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/upgrade.php
Wordpress 2.5.1-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / upgrade.php
index 402e65cc2b5f5200a44fcee936ae1d6d77835bb5..4985aacbbe40946b678f7efad26525ca2adc9be2 100644 (file)
@@ -6,7 +6,7 @@ require_once(ABSPATH . 'wp-admin/includes/admin.php');
 require_once(ABSPATH . 'wp-admin/includes/schema.php');
 
 if ( !function_exists('wp_install') ) :
-function wp_install($blog_title, $user_name, $user_email, $public, $meta='') {
+function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') {
        global $wp_rewrite;
 
        wp_check_mysql_version();
@@ -35,7 +35,7 @@ function wp_install($blog_title, $user_name, $user_email, $public, $meta='') {
        // being shared among blogs.  Just set the role in that case.
        $user_id = username_exists($user_name);
        if ( !$user_id ) {
-               $random_password = substr(md5(uniqid(microtime())), 0, 6);
+               $random_password = wp_generate_password();
                $user_id = wp_create_user($user_name, $random_password, $user_email);
        } else {
                $random_password = __('User already exists.  Password inherited.');
@@ -62,13 +62,13 @@ function wp_install_defaults($user_id) {
 
        // Default category
        $cat_name = $wpdb->escape(__('Uncategorized'));
-       $cat_slug = sanitize_title(__('Uncategorized'));
+       $cat_slug = sanitize_title(_c('Uncategorized|Default category slug'));
        $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
        $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')");
 
        // Default link category
        $cat_name = $wpdb->escape(__('Blogroll'));
-       $cat_slug = sanitize_title(__('Blogroll'));
+       $cat_slug = sanitize_title(_c('Blogroll|Default link category slug'));
        $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')");
        $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('2', 'link_category', '', '0', '7')");
 
@@ -98,14 +98,15 @@ function wp_install_defaults($user_id) {
        $now = date('Y-m-d H:i:s');
        $now_gmt = gmdate('Y-m-d H:i:s');
        $first_post_guid = get_option('home') . '/?p=1';
-       $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')");
+       $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(_c('hello-world|Default post slug'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')");
        $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 1)" );
 
        // Default comment
        $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");
 
        // First Page
-       $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'publish', 'page', '', '', '')");
+       $first_post_guid = get_option('home') . '/?page_id=2';
+       $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(_c('about|Default page slug'))."', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')");
 }
 endif;
 
@@ -198,6 +199,12 @@ function upgrade_all() {
        if ( $wp_current_db_version < 6124 )
                upgrade_230_old_tables();
 
+       if ( $wp_current_db_version < 7499 )
+               upgrade_250();
+
+       if ( $wp_current_db_version < 7796 )
+               upgrade_251();
+
        maybe_disable_automattic_widgets();
 
        $wp_rewrite->flush_rules();
@@ -716,6 +723,22 @@ function upgrade_old_slugs() {
 }
 
 
+function upgrade_250() {
+       global $wp_current_db_version;
+
+       if ( $wp_current_db_version < 6689 ) {
+               populate_roles_250();
+       }
+       
+}
+
+function upgrade_251() {
+       global $wp_current_db_version;
+
+       // Make the secret longer
+       update_option('secret', wp_generate_password(64));
+}
+
 // The functions we use to actually do stuff
 
 // General
@@ -1244,12 +1267,10 @@ function translate_level_to_role($level) {
 }
 
 function wp_check_mysql_version() {
-       global $wp_version;
-
-       // Make sure the server has MySQL 4.0
-       $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info());
-       if ( version_compare($mysql_version, '4.0.0', '<') )
-               die(sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
+       global $wpdb;
+       $result = $wpdb->check_database_version();
+       if ( is_wp_error( $result ) )
+               die( $result->get_error_message() );
 }
 
 function maybe_disable_automattic_widgets() {