Skip to content

Commit b5906a5

Browse files
committed
Add cli self-uninstall command
Signed-off-by: Kirtan Gajjar <[email protected]>
1 parent 2cef0dc commit b5906a5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

php/commands/src/CLI_Command.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public function info( $_, $assoc_args ) {
162162
/**
163163
* Function to run migrations required to upgrade to the newer version. Will always be invoked from the newer phar downloaded inside the /tmp folder
164164
*/
165-
public function migrate() {
165+
private function migrate() {
166166
EE\Migration\Executor::execute_migrations();
167167
}
168168

@@ -488,6 +488,20 @@ public function cmd_dump() {
488488
echo json_encode( $this->command_to_array( EE::get_root_command() ) );
489489
}
490490

491+
/**
492+
* Uninstalls easyengine completely along with all sites
493+
*
494+
* @subcommand self-uninstall
495+
*/
496+
public function self_uninstall() {
497+
EE::confirm("Are you sure you want to remove EasyEngine and all its sites(along with their data) ?");
498+
Utils\default_launch("docker rm -f $(docker ps -aqf label=org.label-schema.vendor=\"EasyEngine\")");
499+
$home = Utils\get_home_dir();
500+
Utils\default_launch("rm -rf $home/.ee/");
501+
Utils\default_launch("rm -rf $home/ee-sites/");
502+
Utils\default_launch("rm -rf " . EE_CONF_ROOT);
503+
}
504+
491505
/**
492506
* Generate tab completion strings.
493507
*

0 commit comments

Comments
 (0)