Disallow overriding commands with scripts
parent
ca8ce161e1
commit
a8adbfeb9f
|
@ -89,12 +89,12 @@ EOT
|
||||||
putenv('PATH='.realpath($binDir).PATH_SEPARATOR.getenv('PATH'));
|
putenv('PATH='.realpath($binDir).PATH_SEPARATOR.getenv('PATH'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = $input->getArguments();
|
$args = $input->getArgument('args');
|
||||||
|
|
||||||
if (in_array($script, $this->commandEvents)) {
|
if (in_array($script, $this->commandEvents)) {
|
||||||
return $composer->getEventDispatcher()->dispatchCommandEvent($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
|
return $composer->getEventDispatcher()->dispatchCommandEvent($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
|
return $composer->getEventDispatcher()->dispatchScript($script, $input->getOption('dev') || !$input->getOption('no-dev'), $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,11 +117,15 @@ class Application extends BaseApplication
|
||||||
if (isset($composer['scripts']) && is_array($composer['scripts'])) {
|
if (isset($composer['scripts']) && is_array($composer['scripts'])) {
|
||||||
foreach ($composer['scripts'] as $script => $dummy) {
|
foreach ($composer['scripts'] as $script => $dummy) {
|
||||||
if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
|
if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
|
||||||
|
if ($this->has($script)) {
|
||||||
|
$output->writeln('<warning>A script named '.$script.' would override a native Composer function and has been skipped</warning>');
|
||||||
|
} else {
|
||||||
$this->add(new Command\ScriptAliasCommand($script));
|
$this->add(new Command\ScriptAliasCommand($script));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($input->hasParameterOption('--profile')) {
|
if ($input->hasParameterOption('--profile')) {
|
||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
|
|
Loading…
Reference in New Issue