Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<img width="150" height="150" src="https://easyengine.io/wp-content/uploads/2015/11/cropped-favicon-easyengine.png" alt="EasyEngine Logo" align="right" />

[![Build Status](https://travis-ci.org/EasyEngine/easyengine.svg?branch=master-v4)](https://travis-ci.org/EasyEngine/easyengine)
[![License](https://poser.pugx.org/phpunit/phpunit/license)](https://packagist.org/packages/phpunit/phpunit)
[![Join EasyEngine Slack Channel](http://slack.easyengine.io/badge.svg)](http://slack.easyengine.io/)

## Requirements
Expand All @@ -19,7 +20,7 @@
For Linux, we have created an installer script which will install all the dependencies for you. We have tested this on Ubuntu 14.04, 16.04, 18.04 and Debian 8.

```bash
wget -qO ee https://rt.cx/ee4beta && sudo bash ee
wget -qO ee https://rt.cx/ee4 && sudo bash ee
```

Even if the script doesn't work for your distribution, you can manually install the dependencies and then run the following commands to install EasyEngine
Expand Down Expand Up @@ -107,4 +108,3 @@ We warmheartedly welcome all contributions however and in whatever capacity you
## Donations

[![PayPal-Donate](https://cloud.githubusercontent.com/assets/4115/5297691/c7b50292-7bd7-11e4-987b-2dc21069e756.png)](http://rt.cx/eedonate)
[![BitCoin-Donate](https://bitpay.com/img/donate-button.svg)](https://bitpay.com/417008/donate)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
4.0.1
6 changes: 5 additions & 1 deletion ci/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ if [[ "$TRAVIS_BRANCH" != $DEPLOY_BRANCH ]]; then
sed -i 's/\:\ \"\(.*\)\"/\:\ \"\1-nightly\"/g' img-versions.json
fi

php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quiet
php -dphar.readonly=0 ./utils/make-phar.php easyengine.phar --quiet

# Checking the phar is working.
sudo ./easyengine.phar cli info
docker ps -a
60 changes: 43 additions & 17 deletions php/EE/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,54 @@ private function init_ee() {

if (
! empty( $this->arguments ) &&
( 'help' !== $this->arguments[0] )
&& $this->arguments !== [ 'cli', 'version' ]
)
{
( ! in_array( $this->arguments[0], [ 'cli', 'config', 'help' ], true ) )
) {
$this->check_requirements();
$this->maybe_trigger_migration();
}
if ( [ 'cli', 'info' ] === $this->arguments && $this->check_requirements( false ) ) {
$this->maybe_trigger_migration();
}
}

// Minimum requirement checks.
$docker_running = 'docker ps > /dev/null';
if ( ! EE::exec( $docker_running ) ) {
EE::error( 'docker not installed or not running.' );
}
/**
* Check EE requirements for required commands.
*
* @param bool $show_error To display error or to retutn status.
*/
public function check_requirements( $show_error = true ) {

$docker_compose_installed = 'command -v docker-compose > /dev/null';
if ( ! EE::exec( $docker_compose_installed ) ) {
EE::error( 'EasyEngine requires docker-compose.' );
}
$docker_running = true;
$status = true;
$error = [];

if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) {
EE::error( 'EasyEngine requires minimum PHP 7.2.0 to run.' );
}
$docker_running_cmd = 'docker ps > /dev/null';
if ( ! EE::exec( $docker_running_cmd ) ) {
$status = false;
$docker_running = false;
$error[] = 'Docker not installed or not running.';
}

$this->maybe_trigger_migration();
$docker_compose_installed = 'command -v docker-compose > /dev/null';
if ( ! EE::exec( $docker_compose_installed ) ) {
$status = false;
$error[] = 'EasyEngine requires docker-compose.';
}

if ( version_compare( PHP_VERSION, '7.2.0' ) < 0 ) {
$status = false;
$error[] = 'EasyEngine requires minimum PHP 7.2.0 to run.';
}

if ( $show_error && ! $status ) {
EE::error( reset( $error ), false );
if ( IS_DARWIN && ! $docker_running ) {
EE::log( 'For macOS docker can be installed using: `brew cask install docker`' );
}
die;
}

return $status;
}

/**
Expand Down
15 changes: 11 additions & 4 deletions php/commands/src/CLI_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public function update( $_, $assoc_args ) {
$download_url = $newest['package_url'];
$md5_url = str_replace( '.phar', '.phar.md5', $download_url );
}
EE::get_runner()->check_requirements();
EE::log( sprintf( 'Downloading from %s...', $download_url ) );
$temp = \EE\Utils\get_temp_dir() . uniqid( 'ee_', true ) . '.phar';
$headers = array();
Expand Down Expand Up @@ -493,21 +494,27 @@ public function cmd_dump() {
*/
public function self_uninstall( $args, $assoc_args ) {

if ( ! EE::get_runner()->check_requirements( false ) ) {
EE::error( 'Unable to proceed with uninstallation. Seems there is a dependency down.', false );
die;
}

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 );

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

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

$fs = new Filesystem();
if ( ! empty( $records ) ) {
$sites_paths = array_column( $records, 'site_fs_path' );
$fs = new Filesystem();
$fs->remove( $sites_paths );
}

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

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