Opened 15 years ago
Closed 15 years ago
#16676 closed defect (bug) (fixed)
ms-load.php::get_current_site_name floads needlessly the cache
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.3 | Priority: | normal |
| Severity: | normal | Version: | 3.1 |
| Component: | Multisite | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description
wp_cache_set is being called for every call to get_current_site_name even when there is no need to update the cache - this cause slam defence warning with APC vesion 3.1.6 and generally bad for performance
the code there should probably be
function get_current_site_name( $current_site ) {
global $wpdb;
$current_site->site_name = wp_cache_get( $current_site->id . ':site_name', 'site-options' );
if ( ! $current_site->site_name ) {
$current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) );
if ( ! $current_site->site_name )
$current_site->site_name = ucfirst( $current_site->domain );
wp_cache_set( $current_site->id . ':site_name', $current_site->site_name, 'site-options' );
}
return $current_site;
}
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
In [18604]: