File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1010final class MultisiteDataset_Config {
1111 const GLOBAL_DATASET = 'global ' ;
1212 const GLOBAL_READER = 'global__r ' ;
13+ const GLOBAL_WRITER = 'global__w ' ;
1314 const DATASET_FIELD = 'dataset ' ;
1415}
1516
@@ -252,8 +253,17 @@ public function unset_dataset( int $bid ) {
252253 * @param LudicrousDB $wpdb LudicrousDB instance
253254 */
254255 public function shard_update ( $ blog_id , $ shard , $ wpdb ): bool {
255- $ global = MultisiteDataset_Config::GLOBAL_READER ;
256- $ dbh = $ wpdb ->dbhs [ $ global ];
256+ $ handles = array (
257+ MultisiteDataset_Config::GLOBAL_WRITER ,
258+ MultisiteDataset_Config::GLOBAL_READER ,
259+ );
260+ $ dbh = false ;
261+ foreach ( $ handles as $ global ) {
262+ $ dbh = $ wpdb ->dbhs [ $ global ];
263+ if ( ! empty ( $ dbh ) ) {
264+ break ;
265+ }
266+ }
257267 if ( empty ( $ dbh ) ) {
258268 return false ; // should be unreachable, yet...
259269 }
You can’t perform that action at this time.
0 commit comments