Changeset 913
- Timestamp:
- 03/12/07 15:03:18 (2 years ago)
- Files:
-
- trunk/wp-includes/wpmu-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/wpmu-functions.php
r911 r913 228 228 } 229 229 230 function get_site_option( $ option, $default = false, $use_cache = true ) {230 function get_site_option( $key, $default = false, $use_cache = true ) { 231 231 global $wpdb; 232 232 233 233 if( $use_cache == true ) { 234 $value = wp_cache_get($ option, 'site-options');234 $value = wp_cache_get($wpdb->siteid . $key, 'site-options'); 235 235 } else { 236 236 $value = false; … … 238 238 239 239 if ( false === $value ) { 240 $value = $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = '$ option' AND site_id = '$wpdb->siteid'");240 $value = $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = '$key' AND site_id = '{$wpdb->siteid}'"); 241 241 if ( ! is_null($value) ) { 242 wp_cache_set($ option, $value, 'site-options');242 wp_cache_set($wpdb->siteid . $key, $value, 'site-options'); 243 243 } elseif ( $default ) { 244 244 return $default; … … 267 267 $value = serialize($value); 268 268 $value = $wpdb->escape( $value ); 269 wp_cache_delete($ key, 'site-options');270 $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id , meta_key , meta_value ) VALUES ( ' $wpdb->siteid', '$key', '$value')" );269 wp_cache_delete($wpdb->siteid . $key, 'site-options'); 270 $wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id , meta_key , meta_value ) VALUES ( '{$wpdb->siteid}', '$key', '$value')" ); 271 271 return $wpdb->insert_id; 272 272 } … … 285 285 add_site_option( $key, $value ); 286 286 287 $wpdb->query( "UPDATE $wpdb->sitemeta SET meta_value = '".$wpdb->escape( $value )."' WHERE meta_key = '$key'" );288 wp_cache_delete( $ key, 'site-options' );287 $wpdb->query( "UPDATE $wpdb->sitemeta SET meta_value = '".$wpdb->escape( $value )."' WHERE site_id='{$wpdb->siteid}' AND meta_key = '$key'" ); 288 wp_cache_delete( $wpdb->siteid . $key, 'site-options' ); 289 289 } 290 290
