Skip to content

Commit fd6f56c

Browse files
Merge pull request #1310 from mrrobot47/update/self-uninstall
Update self-uninstall
2 parents 7df36c7 + 9fa620c commit fd6f56c

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

ci/prepare.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ fi
1313
php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quiet
1414

1515
# Checking the phar is working.
16-
./easyengine.phar cli info
16+
sudo ./easyengine.phar cli info
17+
docker ps -a

php/EE/Runner.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,34 @@ private function init_ee() {
8181
*/
8282
public function check_requirements( $show_error = true ) {
8383

84-
$status = true;
85-
$error = [];
84+
$docker_running = true;
85+
$status = true;
86+
$error = [];
8687

87-
$docker_running = 'docker ps > /dev/null';
88-
if ( ! EE::exec( $docker_running ) ) {
89-
$status = false;
90-
$error[] = 'Docker not installed or not running.';
88+
$docker_running_cmd = 'docker ps > /dev/null';
89+
if ( ! EE::exec( $docker_running_cmd ) ) {
90+
$status = false;
91+
$docker_running = false;
92+
$error[] = 'Docker not installed or not running.';
9193
}
9294

9395
$docker_compose_installed = 'command -v docker-compose > /dev/null';
9496
if ( ! EE::exec( $docker_compose_installed ) ) {
95-
$status = false;
96-
$error[] = 'EasyEngine requires docker-compose.';
97+
$status = false;
98+
$error[] = 'EasyEngine requires docker-compose.';
9799
}
98100

99101
if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) {
100-
$status = false;
101-
$error[] = 'EasyEngine requires minimum PHP 7.2.0 to run.';
102+
$status = false;
103+
$error[] = 'EasyEngine requires minimum PHP 7.2.0 to run.';
102104
}
103105

104106
if ( $show_error && ! $status ) {
105-
EE::error( reset( $error ) );
107+
EE::error( reset( $error ), false );
108+
if ( IS_DARWIN && ! $docker_running ) {
109+
EE::log( 'For macOS docker can be installed using: `brew cask install docker`' );
110+
}
111+
die;
106112
}
107113

108114
return $status;

php/commands/src/CLI_Command.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,18 +502,19 @@ public function self_uninstall( $args, $assoc_args ) {
502502
EE::confirm( "Are you sure you want to remove EasyEngine and all its sites(along with their data)?\nThis is an irreversible action. No backup will be kept.", $assoc_args );
503503

504504
EE::exec( 'docker rm -f $(docker ps -aqf label=org.label-schema.vendor="EasyEngine")' );
505-
$home = Utils\get_home_dir();
506-
EE::exec( "rm -rf $home/.ee/" );
505+
EE::exec( 'docker network prune -f $(docker network ls -f "label=org.label-schema.vendor=EasyEngine")' );
506+
EE::exec( 'docker volume rm -f $(docker volume ls -f "label=org.label-schema.vendor=EasyEngine" -q)' );
507+
EE::exec( 'docker image rm $(docker image ls -f "label=org.label-schema.vendor=EasyEngine" -q)' );
507508

508509
$records = Site::all( [ 'site_fs_path' ] );
509510

511+
$fs = new Filesystem();
510512
if ( ! empty( $records ) ) {
511513
$sites_paths = array_column( $records, 'site_fs_path' );
512-
$fs = new Filesystem();
513514
$fs->remove( $sites_paths );
514515
}
515516

516-
EE::exec( "rm -rf " . EE_ROOT_DIR );
517+
$fs->remove( EE_ROOT_DIR );
517518

518519
if ( Utils\inside_phar() ) {
519520
unlink( realpath( $_SERVER['argv'][0] ) );

0 commit comments

Comments
 (0)