Changeset 25289
- Timestamp:
- 09/06/2013 06:09:24 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-cron.php
r25001 r25289 29 29 // Uncached doing_cron transient fetch 30 30 function _get_cron_lock() { 31 global $ _wp_using_ext_object_cache, $wpdb;31 global $wpdb; 32 32 33 33 $value = 0; 34 if ( $_wp_using_ext_object_cache) {34 if ( wp_using_ext_object_cache() ) { 35 35 // Skip local cache and force refetch of doing_cron transient in case 36 36 // another processs updated the cache -
trunk/src/wp-includes/load.php
r24581 r25289 371 371 372 372 /** 373 * Access/Modify private global variable $_wp_using_ext_object_cache 374 * 375 * Toggle $_wp_using_ext_object_cache on and off without directly touching global 376 * 377 * @since 3.7.0 378 * 379 * @param bool $using Whether external object cache is being used 380 * @return bool The current 'using' setting 381 */ 382 function wp_using_ext_object_cache( $using = null ) { 383 global $_wp_using_ext_object_cache; 384 $current_using = $_wp_using_ext_object_cache; 385 if ( null !== $using ) 386 $_wp_using_ext_object_cache = $using; 387 return $current_using; 388 } 389 390 /** 373 391 * Starts the WordPress object cache. 374 392 * … … 380 398 */ 381 399 function wp_start_object_cache() { 382 global $ _wp_using_ext_object_cache, $blog_id;400 global $blog_id; 383 401 384 402 $first_init = false; … … 386 404 if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 387 405 require_once ( WP_CONTENT_DIR . '/object-cache.php' ); 388 $_wp_using_ext_object_cache = true; 389 } else { 390 require_once ( ABSPATH . WPINC . '/cache.php' ); 391 $_wp_using_ext_object_cache = false; 406 if ( function_exists( 'wp_cache_init' ) ) 407 wp_using_ext_object_cache( true ); 392 408 } 409 393 410 $first_init = true; 394 } else if ( ! $_wp_using_ext_object_cache&& file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {411 } else if ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) { 395 412 // Sometimes advanced-cache.php can load object-cache.php before it is loaded here. 396 413 // This breaks the function_exists check above and can result in $_wp_using_ext_object_cache 397 414 // being set incorrectly. Double check if an external cache exists. 398 $_wp_using_ext_object_cache = true; 399 } 415 wp_using_ext_object_cache( true ); 416 } 417 418 if ( ! wp_using_ext_object_cache() ) 419 require_once ( ABSPATH . WPINC . '/cache.php' ); 400 420 401 421 // If cache supports reset, reset instead of init if already initialized. … … 404 424 if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) 405 425 wp_cache_switch_to_blog( $blog_id ); 406 else 426 elseif ( function_exists( 'wp_cache_init' ) ) 407 427 wp_cache_init(); 408 428 -
trunk/src/wp-includes/nav-menu.php
r25196 r25289 477 477 */ 478 478 function wp_get_nav_menu_items( $menu, $args = array() ) { 479 global $_wp_using_ext_object_cache;480 481 479 $menu = wp_get_nav_menu_object( $menu ); 482 480 … … 505 503 506 504 // Get all posts and terms at once to prime the caches 507 if ( empty( $fetched[$menu->term_id] ) || $_wp_using_ext_object_cache) {505 if ( empty( $fetched[$menu->term_id] ) || wp_using_ext_object_cache() ) { 508 506 $fetched[$menu->term_id] = true; 509 507 $posts = array(); -
trunk/src/wp-includes/option.php
r25109 r25289 166 166 */ 167 167 function wp_load_core_site_options( $site_id = null ) { 168 global $wpdb , $_wp_using_ext_object_cache;169 170 if ( !is_multisite() || $_wp_using_ext_object_cache|| defined( 'WP_INSTALLING' ) )168 global $wpdb; 169 170 if ( !is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING' ) ) 171 171 return; 172 172 … … 405 405 */ 406 406 function delete_transient( $transient ) { 407 global $_wp_using_ext_object_cache;408 409 407 do_action( 'delete_transient_' . $transient, $transient ); 410 408 411 if ( $_wp_using_ext_object_cache) {409 if ( wp_using_ext_object_cache() ) { 412 410 $result = wp_cache_delete( $transient, 'transient' ); 413 411 } else { … … 444 442 */ 445 443 function get_transient( $transient ) { 446 global $_wp_using_ext_object_cache;447 448 444 $pre = apply_filters( 'pre_transient_' . $transient, false ); 449 445 if ( false !== $pre ) 450 446 return $pre; 451 447 452 if ( $_wp_using_ext_object_cache) {448 if ( wp_using_ext_object_cache() ) { 453 449 $value = wp_cache_get( $transient, 'transient' ); 454 450 } else { … … 494 490 */ 495 491 function set_transient( $transient, $value, $expiration = 0 ) { 496 global $_wp_using_ext_object_cache;497 498 492 $value = apply_filters( 'pre_set_transient_' . $transient, $value ); 499 493 500 if ( $_wp_using_ext_object_cache) {494 if ( wp_using_ext_object_cache() ) { 501 495 $result = wp_cache_set( $transient, $value, 'transient', $expiration ); 502 496 } else { … … 971 965 */ 972 966 function delete_site_transient( $transient ) { 973 global $_wp_using_ext_object_cache;974 975 967 do_action( 'delete_site_transient_' . $transient, $transient ); 976 if ( $_wp_using_ext_object_cache) {968 if ( wp_using_ext_object_cache() ) { 977 969 $result = wp_cache_delete( $transient, 'site-transient' ); 978 970 } else { … … 1009 1001 */ 1010 1002 function get_site_transient( $transient ) { 1011 global $_wp_using_ext_object_cache;1012 1013 1003 $pre = apply_filters( 'pre_site_transient_' . $transient, false ); 1014 1004 if ( false !== $pre ) 1015 1005 return $pre; 1016 1006 1017 if ( $_wp_using_ext_object_cache) {1007 if ( wp_using_ext_object_cache() ) { 1018 1008 $value = wp_cache_get( $transient, 'site-transient' ); 1019 1009 } else { … … 1059 1049 */ 1060 1050 function set_site_transient( $transient, $value, $expiration = 0 ) { 1061 global $_wp_using_ext_object_cache;1062 1063 1051 $value = apply_filters( 'pre_set_site_transient_' . $transient, $value ); 1064 1052 1065 if ( $_wp_using_ext_object_cache) {1053 if ( wp_using_ext_object_cache() ) { 1066 1054 $result = wp_cache_set( $transient, $value, 'site-transient', $expiration ); 1067 1055 } else { -
trunk/src/wp-includes/query.php
r25287 r25289 1947 1947 */ 1948 1948 function get_posts() { 1949 global $wpdb, $user_ID , $_wp_using_ext_object_cache;1949 global $wpdb, $user_ID; 1950 1950 1951 1951 $this->parse_query(); … … 1997 1997 1998 1998 if ( !isset($q['cache_results']) ) { 1999 if ( $_wp_using_ext_object_cache)1999 if ( wp_using_ext_object_cache() ) 2000 2000 $q['cache_results'] = false; 2001 2001 else
Note: See TracChangeset
for help on using the changeset viewer.