Skip to content
Snippets Groups Projects
Commit 9261eddd authored by ale's avatar ale
Browse files

Revert "Add support for github.com/stuttter/ludicrousdb"

This reverts commit 7cf52a2a.

It turns out that the LudicrousDB documentation is slightly misleading,
and the 'dataset' callback actually receives exactly the same arguments as
with HyperDB, so there is no need for custom switching code.
parent 7cf52a2a
No related branches found
No related tags found
No related merge requests found
Pipeline #12779 passed
......@@ -10,7 +10,7 @@ $r2db_hash_map = new Flexihash(null, R2DB_FLEXIHASH_REPLICAS);
*
* Implements a consistent hashing scheme using Flexihash.
*/
function noblogs_hyperdb_callback($query, $wpdb) {
function noblogs_db_callback($query, $wpdb) {
global $r2db_hash_map;
if (preg_match("/^{$wpdb->base_prefix}(\d+)_/", $wpdb->table, $matches)) {
$blog_id = $matches[1];
......@@ -18,22 +18,7 @@ function noblogs_hyperdb_callback($query, $wpdb) {
}
}
/* Same as above but with a slightly different function
signature for https://github.com/stuttter/ludicrousdb */
function noblogs_ludicrousdb_callback($table, $wpdb) {
global $r2db_hash_map;
if (preg_match("/^{$wpdb->base_prefix}(\d+)_/", $table, $matches)) {
$blog_id = $matches[1];
return $r2db_hash_map->lookup($blog_id);
}
return "global";
}
if (defined('R2DB_USE_LUDICROUSDB')) {
$wpdb->add_callback('noblogs_ludicrousdb_callback');
} else {
$wpdb->add_callback('noblogs_hyperdb_callback');
}
$wpdb->add_callback('noblogs_db_callback');
/* Load backend shards and add them to FlexiHash / $wpdb. */
function noblogs_load_backends() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment