Changeset 42723 for trunk/src/wp-includes/load.php
- Timestamp:
- 02/21/2018 02:58:14 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/load.php
r42710 r42723 531 531 function wp_start_object_cache() { 532 532 global $wp_filter; 533 534 $first_init = false; 535 if ( ! function_exists( 'wp_cache_init' ) ) { 536 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 537 require_once( WP_CONTENT_DIR . '/object-cache.php' ); 538 if ( function_exists( 'wp_cache_init' ) ) { 539 wp_using_ext_object_cache( true ); 533 static $first_init = true; 534 535 // Only perform the following checks once. 536 if ( $first_init ) { 537 if ( ! function_exists( 'wp_cache_init' ) ) { 538 /* 539 * This is the normal situation. First-run of this function. No 540 * caching backend has been loaded. 541 * 542 * We try to load a custom caching backend, and then, if it 543 * results in a wp_cache_init() function existing, we note 544 * that an external object cache is being used. 545 */ 546 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 547 require_once( WP_CONTENT_DIR . '/object-cache.php' ); 548 if ( function_exists( 'wp_cache_init' ) ) { 549 wp_using_ext_object_cache( true ); 550 } 551 552 // Re-initialize any hooks added manually by object-cache.php 553 if ( $wp_filter ) { 554 $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter ); 555 } 540 556 } 541 542 // Re-initialize any hooks added manually by object-cache.php 543 if ( $wp_filter ) { 544 $wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter ); 545 } 546 } 547 548 $first_init = true; 549 } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 550 /* 551 * Sometimes advanced-cache.php can load object-cache.php before 552 * it is loaded here. This breaks the function_exists check above 553 * and can result in `$_wp_using_ext_object_cache` being set 554 * incorrectly. Double check if an external cache exists. 555 */ 556 wp_using_ext_object_cache( true ); 557 } elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 558 /* 559 * Sometimes advanced-cache.php can load object-cache.php before 560 * this function is run. This breaks the function_exists() check 561 * above and can result in wp_using_ext_object_cache() returning 562 * false when actually an external cache is in use. 563 */ 564 wp_using_ext_object_cache( true ); 565 } 557 566 } 558 567 … … 576 585 wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) ); 577 586 } 587 588 $first_init = false; 578 589 } 579 590
Note: See TracChangeset
for help on using the changeset viewer.