1
0
Fork 0

Merge remote-tracking branch 'Partugal/dev-warning'

pull/830/merge
Jordi Boggiano 2012-06-24 15:09:36 +02:00
commit 96bff33aa9
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
if (preg_match('{^[a-f0-9]+$}', $this->version)) {
$stub .= 'if (time() > '.(time()+30*86400).') {'.
"\n echo 'This dev build of composer is outdated, please run \"'.\$argv[0].' self-update\" to get the latest.'.PHP_EOL;".
"\n}\n";
$warningTime = time() + 30*86400;
$stub .= "define('COMPOSER_DEV_WARNING_TIME', $warningTime);\n";
}
return $stub .= <<<'EOF'
return $stub . <<<'EOF'
require 'phar://composer.phar/bin/composer';
__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>');
}
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);
}