WordPress.org

Making WordPress.org

Changeset 3635


Ignore:
Timestamp:
07/07/2016 10:34:49 AM (4 years ago)
Author:
ocean90
Message:

Credits API: Don't reinitialize the object cache if the class is used in WordPress context.

There is a [wpcredits] shortcode which is used on wordpress.org/news/. The wp_cache_init() during the page load prevented WordPress from using the right cache buckets after the shortcode was called.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/api.wordpress.org/public_html/core/credits/wp-credits.php

    r2936 r3635  
    6868
    6969    private function __construct( $version, $gp_locale ) {
    70         wp_cache_init();
     70        // Don't reinitialize the object cache if the class is used in WordPress context.
     71        if ( ! function_exists( 'wp_using_ext_object_cache' ) || ! wp_using_ext_object_cache() ) {
     72            wp_cache_init();
     73        }
     74
    7175        $this->version = $version;
    7276        $this->branch  = self::calculate_branch( $this->version );
    73         if ( $gp_locale )
     77        if ( $gp_locale ) {
    7478            $this->set_locale_data( $gp_locale );
     79        }
    7580    }
    7681
Note: See TracChangeset for help on using the changeset viewer.