X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/03f2fa83c13c1b532284205fa7efcab9b8b2c41f..refs/tags/wordpress-4.5.3:/wp-admin/includes/upgrade.php diff --git a/wp-admin/includes/upgrade.php b/wp-admin/includes/upgrade.php index 72d99b77..3ddbc8b1 100644 --- a/wp-admin/includes/upgrade.php +++ b/wp-admin/includes/upgrade.php @@ -27,10 +27,10 @@ if ( !function_exists('wp_install') ) : * * @since 2.1.0 * - * @param string $blog_title Blog title. + * @param string $blog_title Site title. * @param string $user_name User's username. * @param string $user_email User's email. - * @param bool $public Whether blog is public. + * @param bool $public Whether site is public. * @param string $deprecated Optional. Not used. * @param string $user_password Optional. User's chosen password. Default empty (random password). * @param string $language Optional. Language chosen. Default empty. @@ -64,7 +64,7 @@ function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated /* * Create default user. If the user already exists, the user tables are - * being shared among blogs. Just set the role in that case. + * being shared among sites. Just set the role in that case. */ $user_id = username_exists($user_name); $user_password = trim($user_password); @@ -359,8 +359,8 @@ if ( !function_exists('wp_new_blog_notification') ) : * * @since 2.1.0 * - * @param string $blog_title Blog title. - * @param string $blog_url Blog url. + * @param string $blog_title Site title. + * @param string $blog_url Site url. * @param int $user_id User ID. * @param string $password User's Password. */ @@ -447,6 +447,7 @@ endif; * Contains conditional checks to determine which upgrade scripts to run, * based on database version and WP version being updated-to. * + * @ignore * @since 1.0.1 * * @global int $wp_current_db_version @@ -548,6 +549,9 @@ function upgrade_all() { if ( $wp_current_db_version < 35700 ) upgrade_440(); + if ( $wp_current_db_version < 36686 ) + upgrade_450(); + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -559,6 +563,7 @@ function upgrade_all() { /** * Execute changes made in WordPress 1.0. * + * @ignore * @since 1.0.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -617,6 +622,7 @@ function upgrade_100() { /** * Execute changes made in WordPress 1.0.1. * + * @ignore * @since 1.0.1 * * @global wpdb $wpdb WordPress database abstraction object. @@ -637,6 +643,7 @@ function upgrade_101() { /** * Execute changes made in WordPress 1.2. * + * @ignore * @since 1.2.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -699,6 +706,7 @@ function upgrade_110() { /** * Execute changes made in WordPress 1.5. * + * @ignore * @since 1.5.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -785,6 +793,7 @@ function upgrade_130() { /** * Execute changes made in WordPress 2.0. * + * @ignore * @since 2.0.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -871,6 +880,7 @@ function upgrade_160() { /** * Execute changes made in WordPress 2.1. * + * @ignore * @since 2.1.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -918,6 +928,7 @@ function upgrade_210() { /** * Execute changes made in WordPress 2.3. * + * @ignore * @since 2.3.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -1097,6 +1108,7 @@ function upgrade_230() { /** * Remove old options from the database. * + * @ignore * @since 2.3.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -1113,6 +1125,7 @@ function upgrade_230_options_table() { /** * Remove old categories, link2cat, and post2cat database tables. * + * @ignore * @since 2.3.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -1127,6 +1140,7 @@ function upgrade_230_old_tables() { /** * Upgrade old slugs made in version 2.2. * + * @ignore * @since 2.2.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -1140,6 +1154,7 @@ function upgrade_old_slugs() { /** * Execute changes made in WordPress 2.5.0. * + * @ignore * @since 2.5.0 * * @global int $wp_current_db_version @@ -1156,6 +1171,7 @@ function upgrade_250() { /** * Execute changes made in WordPress 2.5.2. * + * @ignore * @since 2.5.2 * * @global wpdb $wpdb WordPress database abstraction object. @@ -1169,6 +1185,7 @@ function upgrade_252() { /** * Execute changes made in WordPress 2.6. * + * @ignore * @since 2.6.0 * * @global int $wp_current_db_version @@ -1183,6 +1200,7 @@ function upgrade_260() { /** * Execute changes made in WordPress 2.7. * + * @ignore * @since 2.7.0 * * @global wpdb $wpdb WordPress database abstraction object. @@ -1202,6 +1220,7 @@ function upgrade_270() { /** * Execute changes made in WordPress 2.8. * + * @ignore * @since 2.8.0 * * @global int $wp_current_db_version @@ -1232,6 +1251,7 @@ function upgrade_280() { /** * Execute changes made in WordPress 2.9. * + * @ignore * @since 2.9.0 * * @global int $wp_current_db_version @@ -1251,6 +1271,7 @@ function upgrade_290() { /** * Execute changes made in WordPress 3.0. * + * @ignore * @since 3.0.0 * * @global int $wp_current_db_version @@ -1296,6 +1317,7 @@ function upgrade_300() { /** * Execute changes made in WordPress 3.3. * + * @ignore * @since 3.3.0 * * @global int $wp_current_db_version @@ -1370,6 +1392,7 @@ function upgrade_330() { /** * Execute changes made in WordPress 3.4. * + * @ignore * @since 3.4.0 * * @global int $wp_current_db_version @@ -1406,6 +1429,7 @@ function upgrade_340() { /** * Execute changes made in WordPress 3.5. * + * @ignore * @since 3.5.0 * * @global int $wp_current_db_version @@ -1436,6 +1460,7 @@ function upgrade_350() { /** * Execute changes made in WordPress 3.7. * + * @ignore * @since 3.7.0 * * @global int $wp_current_db_version @@ -1449,6 +1474,7 @@ function upgrade_370() { /** * Execute changes made in WordPress 3.7.2. * + * @ignore * @since 3.7.2 * @since 3.8.0 * @@ -1463,6 +1489,7 @@ function upgrade_372() { /** * Execute changes made in WordPress 3.8.0. * + * @ignore * @since 3.8.0 * * @global int $wp_current_db_version @@ -1477,6 +1504,7 @@ function upgrade_380() { /** * Execute changes made in WordPress 4.0.0. * + * @ignore * @since 4.0.0 * * @global int $wp_current_db_version @@ -1497,6 +1525,7 @@ function upgrade_400() { /** * Execute changes made in WordPress 4.2.0. * + * @ignore * @since 4.2.0 * * @global int $wp_current_db_version @@ -1507,6 +1536,7 @@ function upgrade_420() {} /** * Executes changes made in WordPress 4.3.0. * + * @ignore * @since 4.3.0 * * @global int $wp_current_db_version Current version. @@ -1545,6 +1575,7 @@ function upgrade_430() { /** * Executes comments changes made in WordPress 4.3.0. * + * @ignore * @since 4.3.0 * * @global int $wp_current_db_version Current version. @@ -1594,6 +1625,7 @@ function upgrade_430_fix_comments() { /** * Executes changes made in WordPress 4.3.1. * + * @ignore * @since 4.3.1 */ function upgrade_431() { @@ -1608,6 +1640,7 @@ function upgrade_431() { /** * Executes changes made in WordPress 4.4.0. * + * @ignore * @since 4.4.0 * * @global int $wp_current_db_version Current version. @@ -1629,6 +1662,31 @@ function upgrade_440() { } } +/** + * Executes changes made in WordPress 4.5.0. + * + * @ignore + * @since 4.5.0 + * + * @global int $wp_current_db_version Current database version. + * @global wpdb $wpdb WordPress database abstraction object. + */ +function upgrade_450() { + global $wp_current_db_version, $wpdb; + + if ( $wp_current_db_version < 36180 ) { + wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); + } + + // Remove unused email confirmation options, moved to usermeta. + if ( $wp_current_db_version < 36679 && is_multisite() ) { + $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^[0-9]+_new_email$'" ); + } + + // Remove unused user setting for wpLink. + delete_user_setting( 'wplink' ); +} + /** * Executes network-level upgrade routines. * @@ -2096,6 +2154,9 @@ function dbDelta( $queries = '', $execute = true ) { */ $iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries ); + $text_fields = array( 'tinytext', 'text', 'mediumtext', 'longtext' ); + $blob_fields = array( 'tinyblob', 'blob', 'mediumblob', 'longblob' ); + $global_tables = $wpdb->tables( 'global' ); foreach ( $cqueries as $table => $qry ) { // Upgrade global tables only for the main site. Don't upgrade at all if conditions are not optimal. @@ -2165,9 +2226,24 @@ function dbDelta( $queries = '', $execute = true ) { // Is actual field type different from the field type in query? if ($tablefield->Type != $fieldtype) { + $do_change = true; + if ( in_array( strtolower( $fieldtype ), $text_fields ) && in_array( strtolower( $tablefield->Type ), $text_fields ) ) { + if ( array_search( strtolower( $fieldtype ), $text_fields ) < array_search( strtolower( $tablefield->Type ), $text_fields ) ) { + $do_change = false; + } + } + + if ( in_array( strtolower( $fieldtype ), $blob_fields ) && in_array( strtolower( $tablefield->Type ), $blob_fields ) ) { + if ( array_search( strtolower( $fieldtype ), $blob_fields ) < array_search( strtolower( $tablefield->Type ), $blob_fields ) ) { + $do_change = false; + } + } + + if ( $do_change ) { // Add a query to change the column type - $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)]; - $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; + $cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)]; + $for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}"; + } } // Get the default value from the array