Make WordPress Core


Ignore:
Timestamp:
09/06/2013 06:09:24 PM (12 years ago)
Author:
wonderboymusic
Message:

Introduce wp_using_ext_object_cache() - mimic wp_suspend_cache_invalidation() and discourage direct access to $_wp_using_ext_object_cache, cleaning up importing of globals in functions and provides function to modify that global. Loads the packaged object cache when an external cache hasn't been loaded or doesn't contain wp_cache_init().

Fixes #21401.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r25109 r25289  
    166166 */
    167167function 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' ) )
    171171        return;
    172172
     
    405405 */
    406406function delete_transient( $transient ) {
    407     global $_wp_using_ext_object_cache;
    408 
    409407    do_action( 'delete_transient_' . $transient, $transient );
    410408
    411     if ( $_wp_using_ext_object_cache ) {
     409    if ( wp_using_ext_object_cache() ) {
    412410        $result = wp_cache_delete( $transient, 'transient' );
    413411    } else {
     
    444442 */
    445443function get_transient( $transient ) {
    446     global $_wp_using_ext_object_cache;
    447 
    448444    $pre = apply_filters( 'pre_transient_' . $transient, false );
    449445    if ( false !== $pre )
    450446        return $pre;
    451447
    452     if ( $_wp_using_ext_object_cache ) {
     448    if ( wp_using_ext_object_cache() ) {
    453449        $value = wp_cache_get( $transient, 'transient' );
    454450    } else {
     
    494490 */
    495491function set_transient( $transient, $value, $expiration = 0 ) {
    496     global $_wp_using_ext_object_cache;
    497 
    498492    $value = apply_filters( 'pre_set_transient_' . $transient, $value );
    499493
    500     if ( $_wp_using_ext_object_cache ) {
     494    if ( wp_using_ext_object_cache() ) {
    501495        $result = wp_cache_set( $transient, $value, 'transient', $expiration );
    502496    } else {
     
    971965 */
    972966function delete_site_transient( $transient ) {
    973     global $_wp_using_ext_object_cache;
    974 
    975967    do_action( 'delete_site_transient_' . $transient, $transient );
    976     if ( $_wp_using_ext_object_cache ) {
     968    if ( wp_using_ext_object_cache() ) {
    977969        $result = wp_cache_delete( $transient, 'site-transient' );
    978970    } else {
     
    10091001 */
    10101002function get_site_transient( $transient ) {
    1011     global $_wp_using_ext_object_cache;
    1012 
    10131003    $pre = apply_filters( 'pre_site_transient_' . $transient, false );
    10141004    if ( false !== $pre )
    10151005        return $pre;
    10161006
    1017     if ( $_wp_using_ext_object_cache ) {
     1007    if ( wp_using_ext_object_cache() ) {
    10181008        $value = wp_cache_get( $transient, 'site-transient' );
    10191009    } else {
     
    10591049 */
    10601050function set_site_transient( $transient, $value, $expiration = 0 ) {
    1061     global $_wp_using_ext_object_cache;
    1062 
    10631051    $value = apply_filters( 'pre_set_site_transient_' . $transient, $value );
    10641052
    1065     if ( $_wp_using_ext_object_cache ) {
     1053    if ( wp_using_ext_object_cache() ) {
    10661054        $result = wp_cache_set( $transient, $value, 'site-transient', $expiration );
    10671055    } else {
Note: See TracChangeset for help on using the changeset viewer.