Skip to content

Commit

Permalink
Update WordPress version and database upgrade procedure
Browse files Browse the repository at this point in the history
Updated the WordPress database version in `version.php` and performed changes in `upgrade.php` to reflect this. Introduced a new function `upgrade_670()` to execute changes made in WordPress version 6.7.0. Additionally, adjusted the indentation in numerous lines for code readability and consistency.
  • Loading branch information
paul bearne committed May 24, 2024
1 parent 8cad35a commit 43b51f5
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 11 deletions.
61 changes: 51 additions & 10 deletions src/wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ function wp_install_defaults( $user_id ) {

if ( ! $first_post ) {
$first_post = "<!-- wp:paragraph -->\n<p>" .
/* translators: First post content. %s: Site link. */
__( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) .
"</p>\n<!-- /wp:paragraph -->";
/* translators: First post content. %s: Site link. */
__( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ) .
"</p>\n<!-- /wp:paragraph -->";
}

$first_post = sprintf(
Expand All @@ -207,9 +207,9 @@ function wp_install_defaults( $user_id ) {
$first_post = str_replace( 'SITE_NAME', get_network()->site_name, $first_post );
} else {
$first_post = "<!-- wp:paragraph -->\n<p>" .
/* translators: First post content. %s: Site link. */
__( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) .
"</p>\n<!-- /wp:paragraph -->";
/* translators: First post content. %s: Site link. */
__( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' ) .
"</p>\n<!-- /wp:paragraph -->";
}

$wpdb->insert(
Expand Down Expand Up @@ -257,7 +257,7 @@ function wp_install_defaults( $user_id ) {
$first_comment_email = ! empty( $first_comment_email ) ? $first_comment_email : '[email protected]';
$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. */
/* 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.
Expand Down Expand Up @@ -307,7 +307,7 @@ function wp_install_defaults( $user_id ) {

$first_page .= "<!-- wp:paragraph -->\n<p>";
$first_page .= sprintf(
/* translators: First page content. %s: Site admin URL. */
/* translators: First page content. %s: Site admin URL. */
__( 'As a new WordPress user, you should go to <a href="%s">your dashboard</a> to delete this page and create new pages for your content. Have fun!' ),
admin_url()
);
Expand Down Expand Up @@ -554,7 +554,7 @@ function wp_new_blog_notification( $blog_title, $blog_url, $user_id, $password )
$login_url = wp_login_url();

$message = sprintf(
/* translators: New site notification email. 1: New site URL, 2: User login, 3: User password or password reset link, 4: Login URL. */
/* translators: New site notification email. 1: New site URL, 2: User login, 3: User password or password reset link, 4: Login URL. */
__(
'Your new WordPress site has been successfully set up at:
Expand Down Expand Up @@ -847,6 +847,9 @@ function upgrade_all() {
upgrade_650();
}

if ( $wp_current_db_version < 57160 ) {
upgrade_670();
}
maybe_disable_link_manager();

maybe_disable_automattic_widgets();
Expand Down Expand Up @@ -973,7 +976,7 @@ function upgrade_110() {

$time_difference = $all_options->time_difference;

$server_time = time() + gmdate( 'Z' );
$server_time = time() + gmdate( 'Z' );

Check failure on line 979 in src/wp-admin/includes/upgrade.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed
$weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
$gmt_time = time();

Expand Down Expand Up @@ -2381,7 +2384,45 @@ function upgrade_650() {
wp_set_option_autoload_values( $autoload );
}
}
/**
* Executes changes made in WordPress 6.5.0.
*
* @ignore
* @since 6.7.0
*
* @global int $wp_current_db_version The old (current) database version.
*/
function upgrade_670() {
global $wp_current_db_version;

if ( $wp_current_db_version < 57160 ) {
$options_ids = array(
'auto_plugin_theme_update_emails',
'recently_activated',
'_wp_suggested_policy_text_has_changed',
'dashboard_widget_options',
'ftp_credentials',
'recently_edited',
'adminhash',
'nav_menu_options',
'active_plugins',
'uninstall_plugins',
'wp_force_deactivated_plugins',
'delete_blog_hash',
'allowedthemes',
'admin_email',
'recently_activated',
'https_detection_errors',
'fresh_site',
'upload_path',
'admin_email',
'admin_email_lifespan',
);

$autoload = array_fill_keys( $options_ids, 'no' );
wp_set_option_autoload_values( $autoload );
}
}
/**
* Executes network-level upgrade routines.
*
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @global int $wp_db_version
*/
$wp_db_version = 57155;
$wp_db_version = 57160;

/**
* Holds the TinyMCE version.
Expand Down

0 comments on commit 43b51f5

Please sign in to comment.