Skip to content

Commit 880cb73

Browse files
committed
Add PHP reloading function for migrations
Signed-off-by: Riddhesh Sanghvi <[email protected]>
1 parent 5d2cf2f commit 880cb73

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

php/EE/Migration/SiteContainers.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,31 @@ public static function delete( $path_to_delete ) {
206206
/**
207207
* Function to reload site's nginx.
208208
*
209-
* @param string $site_fs_path Directory containing site's docker-compose.yml.
209+
* @param string $site_fs_path Directory containing site's docker-compose.yml.
210210
*/
211211
public static function reload_nginx( $site_fs_path ) {
212212

213213
chdir( $site_fs_path );
214-
$success = EE::exec( "docker-compose exec nginx sh -c 'nginx -t && service openresty reload'" );
214+
$success = EE::exec( "docker-compose exec nginx sh -c 'nginx -t && nginx -s reload'" );
215215
if ( ! $success ) {
216216
throw new \Exception( 'Could not reload nginx. Check logs.' );
217217
}
218218
}
219219

220+
/**
221+
* Function to reload site's php.
222+
*
223+
* @param string $site_fs_path Directory containing site's docker-compose.yml.
224+
*/
225+
public static function reload_php( $site_fs_path ) {
226+
227+
chdir( $site_fs_path );
228+
$success = EE::exec( "docker-compose exec php bash -c 'kill -USR2 1'" );
229+
if ( ! $success ) {
230+
throw new \Exception( 'Could not reload php. Check logs.' );
231+
}
232+
}
233+
220234
/**
221235
* Function to pull site docker-compose images.
222236
*

0 commit comments

Comments
 (0)