1
0
Fork 0

don't display dev expiration time warning when running self-update command

pull/829/head
Sergey Linnik 2012-06-24 14:18:07 +04:00
parent 74c2fd5f06
commit 2448c5a7c2
2 changed files with 9 additions and 4 deletions

View File

@ -187,12 +187,11 @@ EOF;
// add warning once the phar is older than 30 days // add warning once the phar is older than 30 days
if (preg_match('{^[a-f0-9]+$}', $this->version)) { if (preg_match('{^[a-f0-9]+$}', $this->version)) {
$stub .= 'if (time() > '.(time()+30*86400).') {'. $warningTime = time() + 30*86400;
"\n echo 'This dev build of composer is outdated, please run \"'.\$argv[0].' self-update\" to get the latest.'.PHP_EOL;". $stub .= "define('COMPOSER_DEV_WARNING_TIME', $warningTime);\n";
"\n}\n";
} }
return $stub .= <<<'EOF' return $stub . <<<'EOF'
require 'phar://composer.phar/bin/composer'; require 'phar://composer.phar/bin/composer';
__HALT_COMPILER(); __HALT_COMPILER();

View File

@ -77,6 +77,12 @@ class Application extends BaseApplication
$output->writeln('<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>'); $output->writeln('<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') && $this->getCommandName($input) !== 'self-update') {
if (time() > COMPOSER_DEV_WARNING_TIME) {
$output->writeln(sprintf('<warning>This dev build of composer is outdated, please run "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
}
}
return parent::doRun($input, $output); return parent::doRun($input, $output);
} }