/** * {@inheritDoc} */ public function doRun(InputInterface $input, OutputInterface $output) { $this->io = new ConsoleIO($input, $output, $this->getHelperSet()); ErrorHandler::register($this->io); if (PHP_VERSION_ID < 50302) { $this->getIO()->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>'); } if (defined('COMPOSER_DEV_WARNING_TIME')) { $commandName = ''; if ($name = $this->getCommandName($input)) { try { $commandName = $this->find($name)->getName(); } catch (\InvalidArgumentException $e) { } } if ($commandName !== 'self-update' && $commandName !== 'selfupdate') { if (time() > COMPOSER_DEV_WARNING_TIME) { $this->getIO()->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF'])); } } } if (getenv('COMPOSER_NO_INTERACTION')) { $input->setInteractive(false); } // switch working dir if ($newWorkDir = $this->getNewWorkingDir($input)) { $oldWorkingDir = getcwd(); chdir($newWorkDir); if ($this->getIO()->isDebug() >= 4) { $this->getIO()->writeError('Changed CWD to ' . getcwd()); } } // add non-standard scripts as own commands $file = Factory::getComposerFile(); if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) { if (isset($composer['scripts']) && is_array($composer['scripts'])) { foreach ($composer['scripts'] as $script => $dummy) { if (!defined('Composer\\Script\\ScriptEvents::' . str_replace('-', '_', strtoupper($script)))) { if ($this->has($script)) { $this->getIO()->writeError('<warning>A script named ' . $script . ' would override a native Composer function and has been skipped</warning>'); } else { $this->add(new Command\ScriptAliasCommand($script)); } } } } } if ($input->hasParameterOption('--profile')) { $startTime = microtime(true); $this->io->enableDebugging($startTime); } $result = parent::doRun($input, $output); if (isset($oldWorkingDir)) { chdir($oldWorkingDir); } if (isset($startTime)) { $this->getIO()->writeError('<info>Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . round(microtime(true) - $startTime, 2) . 's'); } return $result; }
public function __construct() { ErrorHandler::register(); if (function_exists('ini_set')) { ini_set('xdebug.show_exception_trace', false); ini_set('xdebug.scream', false); } parent::__construct('Composer', Composer::VERSION); }
/** * {@inheritdoc} */ public function doRun(InputInterface $input, OutputInterface $output) { $styles = Factory::createAdditionalStyles(); foreach ($styles as $name => $style) { $output->getFormatter()->setStyle($name, $style); } $this->io = new ConsoleIO($input, $output, $this->getHelperSet()); ErrorHandler::register($this->io); return parent::doRun($input, $output); }
public function __construct() { if (function_exists('ini_set')) { ini_set('xdebug.show_exception_trace', false); ini_set('xdebug.scream', false); } if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) { date_default_timezone_set(@date_default_timezone_get()); } ErrorHandler::register(); parent::__construct('Composer', Composer::VERSION); }
/** * @param InputInterface $input An Input instance * @param OutputInterface $output An Output instance * * @return int 0 if everything went fine, or an error code */ public function doRun(InputInterface $input, OutputInterface $output) { $this->io = new ConsoleIO($input, $output, $this->getHelperSet()); ErrorHandler::register($this->io); return parent::doRun($input, $output); }
public function __construct() { ErrorHandler::register(); parent::__construct('Composer', Composer::VERSION); }
/** * Test ErrorHandler handles warnings */ public function testErrorHandlerRespectsAtOperator() { ErrorHandler::register(); @trigger_error('test', E_USER_NOTICE); }
/** * {@inheritDoc} */ public function doRun(InputInterface $input, OutputInterface $output) { $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins'); $io = $this->io = new ConsoleIO($input, $output, $this->getHelperSet()); ErrorHandler::register($io); // switch working dir if ($newWorkDir = $this->getNewWorkingDir($input)) { $oldWorkingDir = getcwd(); chdir($newWorkDir); $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG); } // determine command name to be executed without including plugin commands $commandName = ''; if ($name = $this->getCommandName($input)) { try { $commandName = $this->find($name)->getName(); } catch (\InvalidArgumentException $e) { } } if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) { try { foreach ($this->getPluginCommands() as $command) { if ($this->has($command->getName())) { $io->writeError('<warning>Plugin command ' . $command->getName() . ' (' . get_class($command) . ') would override a Composer command and has been skipped</warning>'); } else { $this->add($command); } } } catch (NoSslException $e) { // suppress these as they are not relevant at this point } $this->hasPluginCommands = true; } // determine command name to be executed incl plugin commands, and check if it's a proxy command $isProxyCommand = false; if ($name = $this->getCommandName($input)) { try { $command = $this->find($name); $commandName = $command->getName(); $isProxyCommand = $command instanceof Command\BaseCommand && $command->isProxyCommand(); } catch (\InvalidArgumentException $e) { } } if (!$isProxyCommand) { $io->writeError(sprintf('Running %s (%s) with %s on %s', Composer::VERSION, Composer::RELEASE_DATE, defined('HHVM_VERSION') ? 'HHVM ' . HHVM_VERSION : 'PHP ' . PHP_VERSION, php_uname('s') . ' / ' . php_uname('r')), true, IOInterface::DEBUG); if (PHP_VERSION_ID < 50302) { $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP ' . PHP_VERSION . ', upgrading is strongly recommended.</warning>'); } if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) { $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>'); } if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) { $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF'])); } if (getenv('COMPOSER_NO_INTERACTION')) { $input->setInteractive(false); } if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER')) { if (function_exists('posix_getuid') && posix_getuid() === 0) { if ($commandName !== 'self-update' && $commandName !== 'selfupdate') { $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>'); } if ($uid = (int) getenv('SUDO_UID')) { // Silently clobber any sudo credentials on the invoking user to avoid privilege escalations later on // ref. https://github.com/composer/composer/issues/5119 Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1"); } } // Silently clobber any remaining sudo leases on the current user as well to avoid privilege escalations Silencer::call('exec', 'sudo -K > /dev/null 2>&1'); } // Check system temp folder for usability as it can cause weird runtime issues otherwise Silencer::call(function () use($io) { $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime()); if (!(file_put_contents($tempfile, __FILE__) && file_get_contents($tempfile) == __FILE__ && unlink($tempfile) && !file_exists($tempfile))) { $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir())); } }); // add non-standard scripts as own commands $file = Factory::getComposerFile(); if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) { if (isset($composer['scripts']) && is_array($composer['scripts'])) { foreach ($composer['scripts'] as $script => $dummy) { if (!defined('Composer\\Script\\ScriptEvents::' . str_replace('-', '_', strtoupper($script)))) { if ($this->has($script)) { $io->writeError('<warning>A script named ' . $script . ' would override a Composer command and has been skipped</warning>'); } else { $this->add(new Command\ScriptAliasCommand($script)); } } } } } } try { if ($input->hasParameterOption('--profile')) { $startTime = microtime(true); $this->io->enableDebugging($startTime); } $result = parent::doRun($input, $output); if (isset($oldWorkingDir)) { chdir($oldWorkingDir); } if (isset($startTime)) { $io->writeError('<info>Memory usage: ' . round(memory_get_usage() / 1024 / 1024, 2) . 'MB (peak: ' . round(memory_get_peak_usage() / 1024 / 1024, 2) . 'MB), time: ' . round(microtime(true) - $startTime, 2) . 's'); } restore_error_handler(); return $result; } catch (ScriptExecutionException $e) { return $e->getCode(); } catch (\Exception $e) { $this->hintCommonErrors($e); restore_error_handler(); throw $e; } }
public function __construct() { parent::__construct('Satis', Satis::VERSION); ErrorHandler::register(); }
/** * Constructor * * @param RegistryInterface $doctrine */ public function __construct(RegistryInterface $doctrine) { $this->doctrine = $doctrine; ErrorHandler::register(); }
public function __construct() { parent::__construct('Compify', Compify::VERSION); ErrorHandler::register(); }
public function __construct(AppKernel $app) { parent::__construct('Terramar Labs Packages', Version::VERSION); ErrorHandler::register(); $this->app = $app; }