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: | mark-k | Owned by: | ryan |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.3 |
| Component: | Multisite | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
In [18604]: