Making WordPress.org

Changeset 3388


Ignore:
Timestamp:
06/16/2016 12:46:27 PM (8 years ago)
Author:
ocean90
Message:

Theme/Plugin Directory: Use a global cache group for locale associations.

Cache gets invalidated when a locale is added or deleted.

Location:
sites/trunk/wordpress.org/public_html/wp-content
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php

    r3387 r3388  
    10631063 */
    10641064function wporg_themes_add_hreflang_link_attributes() {
    1065     $sites = wp_cache_get( 'local-sites', 'locale-associations' );
    1066 
    1067     if ( false === $sites ) {
     1065    wp_cache_add_global_groups( array( 'locale-associations' ) );
     1066
     1067    if ( false === ( $sites = wp_cache_get( 'local-sites', 'locale-associations' ) ) ) {
    10681068        global $wpdb;
     1069
    10691070        $sites = $wpdb->get_results( 'SELECT locale, subdomain FROM locales', OBJECT_K );
    10701071        if ( ! $sites ) {
     
    11101111        } );
    11111112
    1112         wp_cache_set( 'local-sites', $sites, 'locale-associations', DAY_IN_SECONDS );
     1113        wp_cache_set( 'local-sites', $sites, 'locale-associations' );
    11131114    }
    11141115
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php

    r3386 r3388  
    114114 */
    115115function hreflang_link_attributes() {
     116    wp_cache_add_global_groups( array( 'locale-associations' ) );
    116117
    117118    if ( false === ( $sites = wp_cache_get( 'local-sites', 'locale-associations' ) ) ) {
     
    161162        } );
    162163
    163         wp_cache_set( 'local-sites', $sites, 'locale-associations', DAY_IN_SECONDS );
     164        wp_cache_set( 'local-sites', $sites, 'locale-associations' );
    164165    }
    165166
Note: See TracChangeset for help on using the changeset viewer.