File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,10 @@ public function duplicate_tables(): bool {
35
35
return false ;
36
36
}
37
37
38
+ $ new_prefix = $ this ->wpdb ->prefix . $ this ->staging_name . '_ ' ;
39
+
38
40
foreach ( $ tables as $ table ) {
39
- $ staging_table = str_replace ( $ this ->wpdb ->prefix , $ this -> wpdb -> prefix . $ this -> staging_name . ' _ ' , $ table );
41
+ $ staging_table = str_replace ( $ this ->wpdb ->prefix , $ new_prefix , $ table );
40
42
41
43
$ this ->wpdb ->query ( "DROP TABLE IF EXISTS $ staging_table " );
42
44
@@ -49,6 +51,16 @@ public function duplicate_tables(): bool {
49
51
$ this ->wpdb ->query ( "INSERT INTO $ staging_table SELECT * FROM $ table " );
50
52
}
51
53
54
+ $ this ->wpdb ->query ( "INSERT INTO $ staging_table SELECT * FROM $ table " );
55
+
56
+ $ this ->wpdb ->query ( "UPDATE " . $ new_prefix . "usermeta SET meta_key = ' " . $ new_prefix . "capabilities' where meta_key = ' " . $ this ->wpdb ->prefix . "capabilities' " );
57
+
58
+ $ this ->wpdb ->query ( "UPDATE " . $ new_prefix . "usermeta SET meta_key = ' " . $ new_prefix . "user_level' where meta_key = ' " . $ this ->wpdb ->prefix . "user_level' " );
59
+
60
+ $ this ->wpdb ->query ( "UPDATE " . $ new_prefix . "usermeta SET meta_key = ' " . $ new_prefix . "autosave_draft_ids' where meta_key = ' " . $ this ->wpdb ->prefix . "autosave_draft_ids' " );
61
+
62
+ $ this ->wpdb ->query ( "UPDATE " . $ new_prefix . "options SET option_name = ' " . $ new_prefix . "user_roles' where option_name = ' " . $ this ->wpdb ->prefix . "user_roles' " );
63
+
52
64
$ this ->add_hash_table ();
53
65
54
66
return true ;
You can’t perform that action at this time.
0 commit comments