ソースを参照

Rename COMPOSER_DISABLE_ROOT_WARN to COMPOSER_ALLOW_SUPERUSER, refs #5119

Jordi Boggiano 9 年 前
コミット
134ce134a2
2 ファイル変更6 行追加6 行削除
  1. 4 4
      doc/03-cli.md
  2. 2 2
      src/Composer/Console/Application.php

+ 4 - 4
doc/03-cli.md

@@ -794,10 +794,10 @@ If set to 1, this env var will make Composer behave as if you passed the
 
 
 If set to 1, this env disables the warning about having xdebug enabled.
 If set to 1, this env disables the warning about having xdebug enabled.
 
 
-### COMPOSER_DISABLE_ROOT_WARN
+### COMPOSER_ALLOW_SUPERUSER
 
 
-If set to 1, this env disables the warning about running commands as root. It also
-disables automatic clearing of sudo sessions, so you should really only set this
-if you use Composer as root at all times like in docker containers.
+If set to 1, this env disables the warning about running commands as root/super user.
+It also disables automatic clearing of sudo sessions, so you should really only set this
+if you use Composer as super user at all times like in docker containers.
 
 
 ← [Libraries](02-libraries.md)  |  [Schema](04-schema.md) →
 ← [Libraries](02-libraries.md)  |  [Schema](04-schema.md) →

+ 2 - 2
src/Composer/Console/Application.php

@@ -133,10 +133,10 @@ class Application extends BaseApplication
                 $input->setInteractive(false);
                 $input->setInteractive(false);
             }
             }
 
 
-            if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_DISABLE_ROOT_WARN')) {
+            if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) {
                 if (function_exists('posix_getuid') && posix_getuid() === 0) {
                 if (function_exists('posix_getuid') && posix_getuid() === 0) {
                     if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
                     if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
-                        $io->writeError('<warning>Running composer as root is highly discouraged as packages, plugins and scripts cannot always be trusted</warning>');
+                        $io->writeError('<warning>Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted</warning>');
                     }
                     }
                     if ($uid = getenv('SUDO_UID')) {
                     if ($uid = getenv('SUDO_UID')) {
                         // Silently clobber any sudo credentials on the invoking user to avoid privilege escalations later on
                         // Silently clobber any sudo credentials on the invoking user to avoid privilege escalations later on