Make WordPress Core


Ignore:
Timestamp:
10/07/2015 03:01:27 AM (10 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.