Commit 9a9eeecd authored by Fabien Potencier's avatar Fabien Potencier

fixed a regression where the Silex.phar could not be used anymore to simulate requests on the CLI

parent 1cf18343
...@@ -481,12 +481,12 @@ Console ...@@ -481,12 +481,12 @@ Console
Silex includes a lightweight console for updating to the latest Silex includes a lightweight console for updating to the latest
version. version.
To find out which version of Silex you are using, just invoke To find out which version of Silex you are using, invoke ``silex.phar`` on the
``silex.phar`` on the command-line without any arguments: command-line with ``version`` as an argument:
.. code-block:: text .. code-block:: text
$ php silex.phar $ php silex.phar version
Silex version 0a243d3 2011-04-17 14:49:31 +0200 Silex version 0a243d3 2011-04-17 14:49:31 +0200
To check that your are using the latest version, run the ``check`` command: To check that your are using the latest version, run the ``check`` command:
......
...@@ -105,10 +105,8 @@ Phar::mapPhar('silex.phar'); ...@@ -105,10 +105,8 @@ Phar::mapPhar('silex.phar');
require_once 'phar://silex.phar/autoload.php'; require_once 'phar://silex.phar/autoload.php';
if ('cli' === php_sapi_name()) { if ('cli' === php_sapi_name() && isset($argv[1])) {
$command = isset($argv[1]) ? $argv[1] : null; switch ($argv[1]) {
switch ($command) {
case 'update': case 'update':
$remoteFilename = 'http://silex-project.org/get/silex.phar'; $remoteFilename = 'http://silex-project.org/get/silex.phar';
$localFilename = getcwd().'/silex.phar'; $localFilename = getcwd().'/silex.phar';
...@@ -126,10 +124,15 @@ if ('cli' === php_sapi_name()) { ...@@ -126,10 +124,15 @@ if ('cli' === php_sapi_name()) {
} }
break; break;
default: case 'version':
printf("Silex version %s\n", Silex\Application::VERSION); printf("Silex version %s\n", Silex\Application::VERSION);
break; break;
default:
printf("Unkown command '%s' (available commands: version, check, and update).\n", $argv[1]);
} }
exit(0);
} }
__HALT_COMPILER(); __HALT_COMPILER();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment