WordPress.org

Make WordPress Core

Changeset 34896


Ignore:
Timestamp:
10/07/2015 03:01:27 AM (4 years ago)
Author:
boonebgorges
Message:

Move wp_installing() to load.php.

Various functions in load.php need to check whether WP is in installation mode.
Let's let them.

Props adamsilverstein.
See #31130.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

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

    r34894 r34896  
    12561256     */
    12571257    echo apply_filters( 'robots_txt', $output, $public );
    1258 }
    1259 
    1260 /**
    1261  * Check or set whether WordPress is in "installation" mode.
    1262  *
    1263  * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`.
    1264  *
    1265  * @since 4.4.0
    1266  *
    1267  * @staticvar bool $installing
    1268  *
    1269  * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off.
    1270  *                            Omit this parameter if you only want to fetch the current status.
    1271  * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
    1272  *              report whether WP was in installing mode prior to the change to `$is_installing`.
    1273  */
    1274 function wp_installing( $is_installing = null ) {
    1275     static $installing = null;
    1276 
    1277     // Support for the `WP_INSTALLING` constant, defined before WP is loaded.
    1278     if ( is_null( $installing ) ) {
    1279         $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
    1280     }
    1281 
    1282     if ( ! is_null( $is_installing ) ) {
    1283         $old_installing = $installing;
    1284         $installing = $is_installing;
    1285         return (bool) $old_installing;
    1286     }
    1287 
    1288     return (bool) $installing;
    12891258}
    12901259
  • trunk/src/wp-includes/load.php

    r34894 r34896  
    849849    $wp_locale = new WP_Locale();
    850850}
     851
     852/**
     853 * Check or set whether WordPress is in "installation" mode.
     854 *
     855 * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`.
     856 *
     857 * @since 4.4.0
     858 *
     859 * @staticvar bool $installing
     860 *
     861 * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off.
     862 *                            Omit this parameter if you only want to fetch the current status.
     863 * @return bool True if WP is installing, otherwise false. When a `$is_installing` is passed, the function will
     864 *              report whether WP was in installing mode prior to the change to `$is_installing`.
     865 */
     866function wp_installing( $is_installing = null ) {
     867    static $installing = null;
     868
     869    // Support for the `WP_INSTALLING` constant, defined before WP is loaded.
     870    if ( is_null( $installing ) ) {
     871        $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
     872    }
     873
     874    if ( ! is_null( $is_installing ) ) {
     875        $old_installing = $installing;
     876        $installing = $is_installing;
     877        return (bool) $old_installing;
     878    }
     879
     880    return (bool) $installing;
     881}
Note: See TracChangeset for help on using the changeset viewer.