diff -r be944660c56a -r 3d72ae0968f4 wp/wp-admin/includes/upgrade.php --- a/wp/wp-admin/includes/upgrade.php Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-admin/includes/upgrade.php Tue Sep 27 16:37:53 2022 +0200 @@ -31,7 +31,7 @@ * @param string $blog_title Site title. * @param string $user_name User's username. * @param string $user_email User's email. - * @param bool $public Whether site is public. + * @param bool $is_public Whether the 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. @@ -44,7 +44,7 @@ * @type string $password_message The explanatory message regarding the password. * } */ - function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) { + function wp_install( $blog_title, $user_name, $user_email, $is_public, $deprecated = '', $user_password = '', $language = '' ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '2.6.0' ); } @@ -57,7 +57,7 @@ update_option( 'blogname', $blog_title ); update_option( 'admin_email', $user_email ); - update_option( 'blog_public', $public ); + update_option( 'blog_public', $is_public ); // Freshness of site - in the future, this could get more specific about actions taken, perhaps. update_option( 'fresh_site', 1 ); @@ -71,7 +71,7 @@ update_option( 'siteurl', $guessurl ); // If not a public site, don't ping. - if ( ! $public ) { + if ( ! $is_public ) { update_option( 'default_pingback_flag', 0 ); } @@ -249,6 +249,11 @@ 'post_content_filtered' => '', ) ); + + if ( is_multisite() ) { + update_posts_count(); + } + $wpdb->insert( $wpdb->term_relationships, array( @@ -267,11 +272,15 @@ $first_comment_author = ! empty( $first_comment_author ) ? $first_comment_author : __( 'A WordPress Commenter' ); $first_comment_email = ! empty( $first_comment_email ) ? $first_comment_email : 'wapuu@wordpress.example'; - $first_comment_url = ! empty( $first_comment_url ) ? $first_comment_url : 'https://wordpress.org/'; - $first_comment = ! empty( $first_comment ) ? $first_comment : __( - 'Hi, this is a comment. + $first_comment_url = ! empty( $first_comment_url ) ? $first_comment_url : esc_url( __( 'https://wordpress.org/' ) ); + $first_comment = ! empty( $first_comment ) ? $first_comment : sprintf( + /* translators: %s: Gravatar URL. */ + __( + 'Hi, this is a comment. To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard. -Commenter avatars come from Gravatar.' +Commenter avatars come from Gravatar.' + ), + esc_url( __( 'https://en.gravatar.com/' ) ) ); $wpdb->insert( $wpdb->comments, @@ -832,6 +841,14 @@ upgrade_560(); } + if ( $wp_current_db_version < 51917 ) { + upgrade_590(); + } + + if ( $wp_current_db_version < 53011 ) { + upgrade_600(); + } + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -1612,8 +1629,8 @@ $start = 0; while ( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) { foreach ( $rows as $row ) { - $value = $row->option_value; - if ( ! @unserialize( $value ) ) { + $value = maybe_unserialize( $row->option_value ); + if ( $value === $row->option_value ) { $value = stripslashes( $value ); } if ( $value !== $row->option_value ) { @@ -1874,7 +1891,6 @@ * * @ignore * @since 3.7.2 - * @since 3.8.0 * * @global int $wp_current_db_version The old (current) database version. */ @@ -2249,6 +2265,44 @@ } /** + * Executes changes made in WordPress 5.9.0. + * + * @ignore + * @since 5.9.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ +function upgrade_590() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 51917 ) { + $crons = _get_cron_array(); + + if ( $crons && is_array( $crons ) ) { + // Remove errant `false` values, see #53950, #54906. + $crons = array_filter( $crons ); + _set_cron_array( $crons ); + } + } +} + +/** + * Executes changes made in WordPress 6.0.0. + * + * @ignore + * @since 6.0.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ +function upgrade_600() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 53011 ) { + wp_update_user_counts(); + } +} + +/** * Executes network-level upgrade routines. * * @since 3.0.0