Patch for HyperDB
-
Multisite Clone Duplicator 1.1 does not work when using the extension HyperDB because it does not take into account that the blogs can be in different databases.
I have written some changes to get it working when there are several databases in the same server. The changes are for file lib/data.php and are as follows:
1.- Change this line:
$sql_query = $wpdb->prepare('SHOW TABLES LIKE %s',$from_site_prefix.'%');
by this line:
$sql_query = $wpdb->prepare('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE %s', $from_site_prefix . '%');
2.- Add the following code after line 56:
$sql_query = $wpdb->prepare('SELECT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = %s', $table); $schema = MUCD_Data::do_sql_query($sql_query, 'var');
3.- Change this line:
MUCD_Data::do_sql_query('CREATE TABLE IF NOT EXISTS ' . $table_name . ' LIKE ' . $table);
by this line:
MUCD_Data::do_sql_query('CREATE TABLE IF NOT EXISTS ' . $table_name . ' LIKE ' . $schema . '.' . $table);
4.- And, finally, change this line:
MUCD_Data::do_sql_query('INSERT ' . $table_name . ' SELECT * FROM ' . $table);
by this line:
MUCD_Data::do_sql_query('INSERT ' . $table_name . ' SELECT * FROM ' . $schema . '.' . $table);
Hope this may help to somebody! ??
Toni
- The topic ‘Patch for HyperDB’ is closed to new replies.