Skip to content

Commit faf9676

Browse files
committed
Update site service migrations
Signed-off-by: Riddhesh Sanghvi <[email protected]>
1 parent f5790f0 commit faf9676

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

php/EE/Migration/Containers.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ public static function image_cleanup() {
128128
*/
129129
public static function update_docker_compose() {
130130

131-
$docker_compose_version = EE::launch( 'docker-compose version --short' )->stdout;
132-
$docker_compose_path = EE::launch( 'command -v docker-compose' )->stdout;
133-
$docker_compose_path = trim( $docker_compose_path );
131+
$docker_compose_version = trim( EE::launch( 'docker-compose version --short' )->stdout );
132+
$docker_compose_path = trim( EE::launch( 'command -v docker-compose' )->stdout );
134133
$docker_compose_backup_path = EE_BACKUP_DIR . '/docker-compose.backup';
135134
$docker_compose_new_path = EE_BACKUP_DIR . '/docker-compose';
136135

php/EE/Migration/SiteContainers.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,19 @@ public static function revert_site_docker_compose_file( $source_path, $destinati
7070
* @return bool
7171
*/
7272
public static function is_site_service_image_changed( $updated_images, $site_info ) {
73+
7374
chdir( $site_info['site_fs_path'] );
74-
$launch = EE::launch( 'docker-compose config --services' );
75-
$services = explode( PHP_EOL, trim( $launch->stdout ) );
75+
$launch = EE::launch( 'docker-compose images' );
76+
$lines = explode( PHP_EOL, trim( $launch->stdout ) );
77+
$site_images = [];
78+
79+
for ( $i = 1; $i < count( $lines ); $i ++ ) {
80+
$columns = preg_split( '/\s+/', $lines[ $i ] );
7681

77-
$site_images = array_map( function ( $service ) {
78-
return 'easyengine/' . $service;
79-
}, $services );
82+
if ( isset( $columns[1] ) ) {
83+
$site_images[] = $columns[1];
84+
}
85+
}
8086

8187
$common_image = array_intersect( $updated_images, $site_images );
8288

0 commit comments

Comments
 (0)