-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.6.5 | ||
4.6.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
migrations/db/20230312102550_easyengine_check_and_update_docker.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace EE\Migration; | ||
|
||
use EE; | ||
use EE\Migration\Base; | ||
|
||
class CheckAndUpdateDocker extends Base { | ||
|
||
/** | ||
* Execute create table query for site and sitemeta table. | ||
* | ||
* @throws EE\ExitException | ||
*/ | ||
public function up() { | ||
|
||
EE::log( 'Checking Docker version.' ); | ||
$docker_version = EE::launch( 'docker version --format "{{.Server.Version}}"' )->stdout; | ||
|
||
if ( version_compare( $docker_version, '20.10.10', '<' ) ) { | ||
EE::warning( 'Docker version should be 20.10.10 or above.' ); | ||
|
||
// If it is MacOS, prompt user to update docker. | ||
if ( 'Darwin' === PHP_OS ) { | ||
EE::confirm( 'Do you want to update Docker?' ); | ||
EE::launch( 'open "docker://"' ); | ||
} | ||
|
||
// If it is Linux, proceed with update. | ||
if ( 'Linux' === PHP_OS ) { | ||
EE::log( 'Updating Docker...' ); | ||
EE::launch( 'curl -fsSL https://get.docker.com | sh' ); | ||
} | ||
} | ||
|
||
// Check the version again post update. | ||
$docker_version = EE::launch( 'docker version --format "{{.Server.Version}}"' )->stdout; | ||
if ( version_compare( $docker_version, '20.10.10', '<' ) ) { | ||
EE::error( 'Docker version should be 20.10.10 or above. Please update Docker and try again.' ); | ||
} | ||
} | ||
|
||
/** | ||
* Execute drop table query for site and sitemeta table. | ||
* | ||
* @throws EE\ExitException | ||
*/ | ||
public function down() { | ||
|
||
} | ||
} |