@@ -37,11 +37,15 @@ public function up() {
3737 /**
3838 * Sites wp-config changes for global-cache.
3939 */
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+
4145 foreach ( $ cache_sites as $ site ) {
4246
4347 self ::$ rsp ->add_step (
44- sprintf ( 'update-cache-host-%s ' , $ site-> site_url ),
48+ sprintf ( 'update-cache-host-%s ' , $ site[ ' site_url ' ] ),
4549 'EE\Migration\ChangeGlobalServiceContainerNames::update_cache_host ' ,
4650 null ,
4751 [ $ site ],
@@ -277,26 +281,26 @@ public static function start_global_service_containers( $containers ) {
277281 /**
278282 * Update redis cache host name.
279283 *
280- * @param $site_info EE\Model\Site site information.
284+ * @param $site_info array of site information.
281285 *
282286 * @throws \Exception
283287 */
284288 public static function update_cache_host ( $ site_info ) {
285289 $ 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 " ;
286290 $ redis_plugin_constant = 'docker-compose exec --user= \'www-data \' php wp config set --type=variable redis_server "array( \'host \'=> \'global-redis \', \'port \'=> 6379,)" --raw ' ;
287291
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 ' ] ) );
290294 }
291295
292296 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 ' ] ) );
294298 }
295299
296300 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 ' ] ) );
298302 }
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 ' ] ) );
300304 }
301305
302306}
0 commit comments