From c918c1ede1d27d2d94aab9e2087f3f74dd429cc7 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Sun, 12 Jun 2016 02:43:27 +0000 Subject: [PATCH] Bootstrap/Load. Adjust filters added in [37626]. These adjustments improve the documentation for the filters and adjust the names make them more consistent with other filters already in core. See #34936. Props DrewAPicture, ocean90, jorbin Built from https://develop.svn.wordpress.org/trunk@37690 git-svn-id: http://core.svn.wordpress.org/trunk@37656 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/load.php | 34 ++++++++++++++++++---------------- wp-includes/version.php | 2 +- wp-settings.php | 11 ++++++----- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/wp-includes/load.php b/wp-includes/load.php index 54ed0400be..80654f1bff 100644 --- a/wp-includes/load.php +++ b/wp-includes/load.php @@ -183,20 +183,22 @@ function wp_maintenance() { // If the $upgrading timestamp is older than 10 minutes, don't die. if ( ( time() - $upgrading ) >= 600 ) return; - + /** - * Bypass the maintenance mode check + * Filters whether to enable maintenance mode. * - * This filter should *NOT* be used by plugins. It is designed for non-web - * runtimes. If this filter returns true, maintenance mode will not be - * active which can cause problems during updates for web site views. + * This filter runs before it can be used by plugins. It is designed for + * non-web runtimes. If this filter returns true, maintenance mode will be + * active and the request will end. If false, the request will be allowed to + * continue processing even if maintenance mode should be active. * * @since 4.6.0 * - * @param bool True to bypass maintenance + * @param bool $enable_checks Whether to enable maintenance mode. Default true. + * @param int $upgrading The timestamp set in the .maintenance file. */ - if ( apply_filters( 'bypass_maintenance_mode', false ) ){ - return; + if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) { + return; } if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) { @@ -301,19 +303,19 @@ function timer_stop( $display = 0, $precision = 3 ) { */ function wp_debug_mode() { /** - * Bypass the debug mode check + * Filters whether to allow the debug mode check to occur. * - * This filter should *NOT* be used by plugins. It is designed for non-web - * runtimes. Returning true causes the WP_DEBUG and related constants to - * not be checked and the default php values for errors will be used unless - * you take care to update them yourself. + * This filter runs before it can be used by plugins. It is designed for + * non-web run-times. Returning false causes the `WP_DEBUG` and related + * constants to not be checked and the default php values for errors + * will be used unless you take care to update them yourself. * * @since 4.6.0 * - * @param bool True to bypass debug mode + * @param bool $enable_debug_mode Whether to enable debug mode checks to occur. Default true. */ - if ( apply_filters( 'bypass_debug_mode', false ) ){ - return; + if ( ! apply_filters( 'enable_wp_debug_mode_checks', true ) ){ + return; } if ( WP_DEBUG ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 4bcfb6a39d..932ff17a3d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37689'; +$wp_version = '4.6-alpha-37690'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-settings.php b/wp-settings.php index e139f07d92..ae7a1735ea 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -71,16 +71,17 @@ timer_start(); wp_debug_mode(); /** - * Bypass the loading of advanced-cache.php + * Filters whether to enable loading of the advanced-cache.php drop-in. * - * This filter should *NOT* be used by plugins. It is designed for non-web - * runtimes. If true is returned, advance-cache.php will never be loaded. + * This filter runs before it can be used by plugins. It is designed for non-web + * run-times. If false is returned, advance-cache.php will never be loaded. * * @since 4.6.0 * - * @param bool True to bypass advanced-cache.php + * @param bool $enable_advanced_cache Whether to enable loading advanced-cache.php (if present). + * Default true. */ -if ( WP_CACHE && ! apply_filters( 'bypass_advanced_cache', false ) ) { +if ( WP_CACHE && apply_filters( 'enable_loading_advanced_cache_dropin', true ) ) { // For an advanced caching plugin to use. Uses a static drop-in because you would only want one. _backup_plugin_globals(); WP_DEBUG ? include( WP_CONTENT_DIR . '/advanced-cache.php' ) : @include( WP_CONTENT_DIR . '/advanced-cache.php' );