@@ -37,11 +37,15 @@ public function up() {
37
37
/**
38
38
* Sites wp-config changes for global-cache.
39
39
*/
40
- $ cache_sites = EE \Model \Site::where ( 'cache_host ' , 'global-redis ' );
40
+ $ cache_sites = EE ::db ()
41
+ ->table ( 'sites ' )
42
+ ->where ( [ [ 'site_type ' , '== ' , 'wp ' ], [ 'cache_host ' , '== ' , 'global-redis ' ] ] )
43
+ ->all ();
44
+
41
45
foreach ( $ cache_sites as $ site ) {
42
46
43
47
self ::$ rsp ->add_step (
44
- sprintf ( 'update-cache-host-%s ' , $ site-> site_url ),
48
+ sprintf ( 'update-cache-host-%s ' , $ site[ ' site_url ' ] ),
45
49
'EE\Migration\ChangeGlobalServiceContainerNames::update_cache_host ' ,
46
50
null ,
47
51
[ $ site ],
@@ -277,26 +281,26 @@ public static function start_global_service_containers( $containers ) {
277
281
/**
278
282
* Update redis cache host name.
279
283
*
280
- * @param $site_info EE\Model\Site site information.
284
+ * @param $site_info array of site information.
281
285
*
282
286
* @throws \Exception
283
287
*/
284
288
public static function update_cache_host ( $ site_info ) {
285
289
$ update_hostname_constant = "docker-compose exec --user='www-data' php wp config set RT_WP_NGINX_HELPER_REDIS_HOSTNAME global-redis --add=true --type=constant " ;
286
290
$ redis_plugin_constant = 'docker-compose exec --user= \'www-data \' php wp config set --type=variable redis_server "array( \'host \'=> \'global-redis \', \'port \'=> 6379,)" --raw ' ;
287
291
288
- if ( ! chdir ( $ site_info-> site_fs_path ) ) {
289
- throw new \Exception ( sprintf ( '%s path not exists ' , $ site_info-> site_fs_path ) );
292
+ if ( ! chdir ( $ site_info[ ' site_fs_path ' ] ) ) {
293
+ throw new \Exception ( sprintf ( '%s path not exists ' , $ site_info[ ' site_fs_path ' ] ) );
290
294
}
291
295
292
296
if ( ! EE ::exec ( $ update_hostname_constant ) ) {
293
- throw new \Exception ( sprintf ( 'Unable to update cache host of %s ' , $ site_info-> site_url ) );
297
+ throw new \Exception ( sprintf ( 'Unable to update cache host of %s ' , $ site_info[ ' site_url ' ] ) );
294
298
}
295
299
296
300
if ( ! EE ::exec ( $ redis_plugin_constant ) ) {
297
- throw new \Exception ( sprintf ( 'Unable to update plugin constant %s ' , $ site_info-> site_url ) );
301
+ throw new \Exception ( sprintf ( 'Unable to update plugin constant %s ' , $ site_info[ ' site_url ' ] ) );
298
302
}
299
- EE ::log ( sprintf ( '%s Updated cache-host successfully ' , $ site_info-> site_url ) );
303
+ EE ::log ( sprintf ( '%s Updated cache-host successfully ' , $ site_info[ ' site_url ' ] ) );
300
304
}
301
305
302
306
}
0 commit comments