WordPress.org

Make WordPress Core

Changeset 43627


Ignore:
Timestamp:
09/05/2018 09:38:04 AM (18 months ago)
Author:
flixos90
Message:

Upgrade/Install: Add support for an optional $options parameter to populate_options().

Fixes #44893. See #41333.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r43571 r43627  
    357357 *
    358358 * @since 1.5.0
     359 * @since 5.0.0 The $options parameter has been added.
    359360 *
    360361 * @global wpdb $wpdb WordPress database abstraction object.
    361362 * @global int  $wp_db_version
    362363 * @global int  $wp_current_db_version
    363  */
    364 function populate_options() {
     364 *
     365 * @param array $options Optional. Custom option $key => $value pairs to use. Default empty array.
     366 */
     367function populate_options( array $options = array() ) {
    365368    global $wpdb, $wp_db_version, $wp_current_db_version;
    366369
     
    407410    }
    408411
    409     $options = array(
     412    $defaults = array(
    410413        'siteurl'                         => $guessurl,
    411414        'home'                            => $guessurl,
     
    543546    // 3.3
    544547    if ( ! is_multisite() ) {
    545         $options['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version
     548        $defaults['initial_db_version'] = ! empty( $wp_current_db_version ) && $wp_current_db_version < $wp_db_version
    546549            ? $wp_current_db_version : $wp_db_version;
    547550    }
     
    550553    if ( is_multisite() ) {
    551554        /* translators: site tagline */
    552         $options['blogdescription']     = sprintf( __( 'Just another %s site' ), get_network()->site_name );
    553         $options['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
    554     }
     555        $defaults['blogdescription']     = sprintf( __( 'Just another %s site' ), get_network()->site_name );
     556        $defaults['permalink_structure'] = '/%year%/%monthnum%/%day%/%postname%/';
     557    }
     558
     559    $options = wp_parse_args( $options, $defaults );
    555560
    556561    // Set autoload to no for these options
Note: See TracChangeset for help on using the changeset viewer.