diff options
author | Bart Visscher <bartv@thisnet.nl> | 2013-09-19 14:22:32 -0700 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2013-09-19 14:22:32 -0700 |
commit | 8e26f291a7912ccc3520ac53af0ddf1da714fdbc (patch) | |
tree | 6fef8529b3dfca0c8387a413696bbc59238c1ff7 /console.php | |
parent | f9549a446547f297dcdf4617c2d0fdab2938e74a (diff) | |
parent | a9ea99e93d0dc982b5daa3ed7974e5bd419dcd1b (diff) | |
download | nextcloud-server-8e26f291a7912ccc3520ac53af0ddf1da714fdbc.tar.gz nextcloud-server-8e26f291a7912ccc3520ac53af0ddf1da714fdbc.zip |
Merge pull request #4684 from owncloud/improved-console
Use more object oriented way for console commands
Diffstat (limited to 'console.php')
-rw-r--r-- | console.php | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/console.php b/console.php index fbe09d9bb68..25b8b312539 100644 --- a/console.php +++ b/console.php @@ -1,4 +1,3 @@ - <?php /** * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> @@ -7,6 +6,8 @@ * See the COPYING-README file. */ +use Symfony\Component\Console\Application; + $RUNTIME_NOAPPS = true; require_once 'lib/base.php'; @@ -21,32 +22,13 @@ if (!OC::$CLI) { exit(0); } -$self = basename($argv[0]); -if ($argc <= 1) { - $argv[1] = "help"; -} - -$command = $argv[1]; -array_shift($argv); - -switch ($command) { - case 'files:scan': - require_once 'apps/files/console/scan.php'; - break; - case 'status': - require_once 'status.php'; - break; - case 'help': - echo "Usage:" . PHP_EOL; - echo " " . $self . " <command>" . PHP_EOL; - echo PHP_EOL; - echo "Available commands:" . PHP_EOL; - echo " files:scan -> rescan filesystem" .PHP_EOL; - echo " status -> show some status information" .PHP_EOL; - echo " help -> show this help screen" .PHP_EOL; - break; - default: - echo "Unknown command '$command'" . PHP_EOL; - echo "For available commands type ". $self . " help" . PHP_EOL; - break; +$defaults = new OC_Defaults; +$application = new Application($defaults->getName(), \OC_Util::getVersionString()); +require_once 'core/register_command.php'; +foreach(OC_App::getAllApps() as $app) { + $file = OC_App::getAppPath($app).'/appinfo/register_command.php'; + if(file_exists($file)) { + require $file; + } } +$application->run(); |