Skip to content

Commit

Permalink
Merge branch 'develop-v4' into update_command
Browse files Browse the repository at this point in the history
  • Loading branch information
kirtangajjar committed Jun 7, 2018
2 parents 5d51ad2 + 271a5e3 commit 37e2d5c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 44 deletions.
34 changes: 0 additions & 34 deletions php/EE/Runner.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,39 +599,6 @@ private function add_var_to_config_file( $var, $config_file_path, $config = [] )
fclose( $config_file );
}

private function check_root() {
if ( $this->config['allow-root'] ) {
return; # they're aware of the risks!
}
if ( count( $this->arguments ) >= 2 && 'cli' === $this->arguments[0] && in_array( $this->arguments[1], array( 'update', 'info' ), true ) ) {
return; # make it easier to update root-owned copies
}
if ( ! function_exists( 'posix_geteuid' ) ) {
return; # posix functions not available
}
if ( posix_geteuid() !== 0 ) {
return; # not root
}

EE::error(
"YIKES! It looks like you're running this as root. You probably meant to " .
"run this as the user that your WordPress install exists under.\n" .
"\n" .
"If you REALLY mean to run this as root, we won't stop you, but just " .
'bear in mind that any code on this site will then have full control of ' .
"your server, making it quite DANGEROUS.\n" .
"\n" .
"If you'd like to continue as root, please run this again, adding this " .
"flag: --allow-root\n" .
"\n" .
"If you'd like to run it as the user that this site is under, you can " .
"run the following to become the respective user:\n" .
"\n" .
" sudo -u USER -i -- ee <command>\n" .
"\n"
);
}

private function run_alias_group( $aliases ) {
Utils\check_proc_available( 'group alias' );

Expand Down Expand Up @@ -690,7 +657,6 @@ public function start() {
EE::debug( $this->_project_config_path_debug, 'bootstrap' );
EE::debug( 'argv: ' . implode( ' ', $GLOBALS['argv'] ), 'bootstrap' );

$this->check_root();
if ( $this->alias ) {
if ( '@all' === $this->alias && ! isset( $this->aliases['@all'] ) ) {
EE::error( "Cannot use '@all' when no aliases are registered." );
Expand Down
3 changes: 1 addition & 2 deletions php/class-ee.php
Original file line number Diff line number Diff line change
Expand Up @@ -818,15 +818,14 @@ public static function launch( $command, $exit_on_error = true, $return_detailed
* @param array $assoc_args Associative arguments to include when calling the command.
* @param bool $exit_on_error Whether to exit if the command returns an elevated return code.
* @param bool $return_detailed Whether to return an exit status (default) or detailed execution results.
* @param array $runtime_args Override one or more global args (path,url,user,allow-root)
* @param array $runtime_args Override one or more global args (path,url,user)
* @return int|ProcessRun The command exit status, or a ProcessRun instance
*/
public static function launch_self( $command, $args = array(), $assoc_args = array(), $exit_on_error = true, $return_detailed = false, $runtime_args = array() ) {
$reused_runtime_args = array(
'path',
'url',
'user',
'allow-root',
);

foreach ( $reused_runtime_args as $key ) {
Expand Down
8 changes: 0 additions & 8 deletions php/config-spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,4 @@
'desc' => 'Suppress informational messages.',
),

# --allow-root => (NOT RECOMMENDED) Allow ee to run as root. This poses
# a security risk, so you probably do not want to do this.
'allow-root' => array(
'file' => false, # Explicit. Just in case the default changes.
'runtime' => '',
'hidden' => true,
),

);

0 comments on commit 37e2d5c

Please sign in to comment.