summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-08-29 12:05:32 -0700
committerMorris Jobke <morris.jobke@gmail.com>2013-08-29 12:05:32 -0700
commit0a23ac18bc1f74cea98eed2c37aa03c99fd957f7 (patch)
tree286e5d2bab17c0286ab9e140633c469aaed5de5a
parent0104d3df960c9b834e8b56b654acfc16c3a7bdd8 (diff)
parent04b9e77478a36b9ef9ed48a8181ed9195d47ec8a (diff)
downloadnextcloud-server-0a23ac18bc1f74cea98eed2c37aa03c99fd957f7.tar.gz
nextcloud-server-0a23ac18bc1f74cea98eed2c37aa03c99fd957f7.zip
Merge pull request #4642 from masakik/master
Minor enhancement to console.php
-rw-r--r--console.php30
-rw-r--r--status.php7
2 files changed, 28 insertions, 9 deletions
diff --git a/console.php b/console.php
index 4aec5bdc24f..fbe09d9bb68 100644
--- a/console.php
+++ b/console.php
@@ -1,3 +1,4 @@
+
<?php
/**
* Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
@@ -20,17 +21,32 @@ if (!OC::$CLI) {
exit(0);
}
+$self = basename($argv[0]);
if ($argc <= 1) {
- echo "Usage:" . PHP_EOL;
- echo " " . basename($argv[0]) . " <command>" . PHP_EOL;
- exit(0);
+ $argv[1] = "help";
}
$command = $argv[1];
array_shift($argv);
-if ($command === 'files:scan') {
- require_once 'apps/files/console/scan.php';
-} else {
- echo "Unknown command '$command'" . PHP_EOL;
+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;
}
diff --git a/status.php b/status.php
index 179fe3f49f2..88422100f14 100644
--- a/status.php
+++ b/status.php
@@ -33,8 +33,11 @@ try {
'version'=>implode('.', OC_Util::getVersion()),
'versionstring'=>OC_Util::getVersionString(),
'edition'=>OC_Util::getEditionString());
-
- echo(json_encode($values));
+ if (OC::$CLI) {
+ print_r($values);
+ } else {
+ echo(json_encode($values));
+ }
} catch (Exception $ex) {
OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);