diff --git a/db-hash.php b/db-hash.php index 8938929ed9c228e46c637a0d6b43a606a10c6bfd..70349eca586d2d09bb0f07ba2bf552d414b0f389 100644 --- a/db-hash.php +++ b/db-hash.php @@ -3,17 +3,17 @@ require_once(dirname(__FILE__) . '/flexihash.php'); require_once( ABSPATH . 'wp-config.php' ); -$wpdb->hash_map = new Flexihash(null, R2DB_FLEXIHASH_REPLICAS); +$r2db_hash_map = new Flexihash(null, R2DB_FLEXIHASH_REPLICAS); /* Hashing function to map blogs to databases. * * Implements a consistent hashing scheme using Flexihash. */ function noblogs_db_callback($query, $wpdb) { - $wpdb_hash = $wpdb->hash_map; + global $r2db_hash_map; if (preg_match("/^{$wpdb->base_prefix}(\d+)_/", $wpdb->table, $matches)) { $blog_id = $matches[1]; - return $wpdb_hash->lookup($blog_id); + return $r2db_hash_map->lookup($blog_id); } } $wpdb->add_callback('noblogs_db_callback');