summaryrefslogtreecommitdiffstats
path: root/wp-includes/wpmu-functions.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-03 13:20:59 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-03 13:20:59 +0000
commit2e2c72c41135182c85528dba91c948d34ac45ade (patch)
treee5a81b784350920824f1787fbeaca31198289987 /wp-includes/wpmu-functions.php
parent0c8ab6757b57b3d8cd156f59bf162ffdb823a3d1 (diff)
downloadwordpress-mu-2e2c72c41135182c85528dba91c948d34ac45ade.tar.gz
wordpress-mu-2e2c72c41135182c85528dba91c948d34ac45ade.tar.xz
wordpress-mu-2e2c72c41135182c85528dba91c948d34ac45ade.zip
Fixed infinite redirect when updating site options, fixes #436, props dreamer12345
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1059 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/wpmu-functions.php')
-rw-r--r--wp-includes/wpmu-functions.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index ad22c68..92f942a 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -278,7 +278,7 @@ function add_site_option( $key, $value ) {
$exists = $wpdb->get_row("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = '$safe_key' AND site_id = '{$wpdb->siteid}'");
- if ( null !== $exists ) {// If we already have it
+ if ( is_object( $exists ) ) {// If we already have it
update_site_option( $key, $value );
return false;
}
@@ -294,17 +294,19 @@ function add_site_option( $key, $value ) {
function update_site_option( $key, $value ) {
global $wpdb;
+ $safe_key = $wpdb->escape( $key );
+
if ( $value == get_site_option( $key ) )
return;
- if ( get_site_option( $key, false, false ) === false )
- add_site_option( $key, $value );
+ $exists = $wpdb->get_row("SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = '$safe_key' AND site_id = '{$wpdb->siteid}'");
+
+ if ( false == is_object( $exists ) ) // It's a new record
+ return add_site_option( $key, $value );
if ( is_array($value) || is_object($value) )
$value = serialize($value);
- $safe_key = $wpdb->escape( $key );
-
$wpdb->query( "UPDATE $wpdb->sitemeta SET meta_value = '" . $wpdb->escape( $value ) . "' WHERE site_id='{$wpdb->siteid}' AND meta_key = '$safe_key'" );
wp_cache_delete( $wpdb->siteid . $key, 'site-options' );
}