Bootstrap: Re-initialize any hooks added manually by `object-cache.php`.

Prior to 3.1 if a object cache dropin wanted to add actions, they needed to use `$wp_filter` directly.

Props jorbin.
Fixes #39132.

Built from https://develop.svn.wordpress.org/trunk@39565


git-svn-id: http://core.svn.wordpress.org/trunk@39505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dion Hulse 2016-12-12 01:29:42 +00:00
parent c21907ca1e
commit bdf6087450
2 changed files with 8 additions and 1 deletions

View File

@ -472,6 +472,8 @@ function wp_using_ext_object_cache( $using = null ) {
* @access private * @access private
*/ */
function wp_start_object_cache() { function wp_start_object_cache() {
global $wp_filter;
$first_init = false; $first_init = false;
if ( ! function_exists( 'wp_cache_init' ) ) { if ( ! function_exists( 'wp_cache_init' ) ) {
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
@ -479,6 +481,11 @@ function wp_start_object_cache() {
if ( function_exists( 'wp_cache_init' ) ) { if ( function_exists( 'wp_cache_init' ) ) {
wp_using_ext_object_cache( true ); wp_using_ext_object_cache( true );
} }
// Re-initialize any hooks added manually by object-cache.php
if ( $wp_filter ) {
$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
}
} }
$first_init = true; $first_init = true;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-39564'; $wp_version = '4.8-alpha-39565';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.