From e2f9dfcebb637ebbe70fbbdaf70deb0d771efc8f Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Wed, 5 Sep 2018 09:39:24 +0000 Subject: [PATCH] Upgrade/Install: Add support for an optional `$options` parameter to `populate_options()`. Fixes #44893. See #41333. Built from https://develop.svn.wordpress.org/trunk@43627 git-svn-id: http://core.svn.wordpress.org/trunk@43456 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/schema.php | 15 ++++++++++----- wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/schema.php b/wp-admin/includes/schema.php index 4611eadc9f..ce6d794c0c 100644 --- a/wp-admin/includes/schema.php +++ b/wp-admin/includes/schema.php @@ -356,12 +356,15 @@ $wp_queries = wp_get_db_schema( 'all' ); * Create WordPress options and set the default values. * * @since 1.5.0 + * @since 5.0.0 The $options parameter has been added. * * @global wpdb $wpdb WordPress database abstraction object. * @global int $wp_db_version * @global int $wp_current_db_version + * + * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array. */ -function populate_options() { +function populate_options( array $options = array() ) { global $wpdb, $wp_db_version, $wp_current_db_version; $guessurl = wp_guess_url(); @@ -406,7 +409,7 @@ function populate_options() { $timezone_string = $offset_or_tz; } - $options = array( + $defaults = array( 'siteurl' => $guessurl, 'home' => $guessurl, 'blogname' => __( 'My Site' ), @@ -542,17 +545,19 @@ function populate_options() { // 3.3 if ( ! is_multisite() ) { - $options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version + $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version ? $wp_current_db_version : $wp_db_version; } // 3.0 multisite if ( is_multisite() ) { /* translators: site tagline */ - $options['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); - $options['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; + $defaults['blogdescription'] = sprintf( __( 'Just another %s site' ), get_network()->site_name ); + $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/'; } + $options = wp_parse_args( $options, $defaults ); + // Set autoload to no for these options $fat_options = array( 'moderation_keys', 'recently_edited', 'blacklist_keys', 'uninstall_plugins' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index ed129c1231..f3aa35472b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0-alpha-43623'; +$wp_version = '5.0-alpha-43627'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.