summaryrefslogtreecommitdiffstats
path: root/console.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-02-21 20:52:32 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-02-23 16:47:47 +0100
commitbcd10d3dc52f2a6fa187895526eac05b48ddb7f9 (patch)
tree8f721cce7ebc7d526f49810e844d1558fdeb2045 /console.php
parent1fd1b355e46aba83917c81ddc91a369598f9e6e1 (diff)
downloadnextcloud-server-bcd10d3dc52f2a6fa187895526eac05b48ddb7f9.tar.gz
nextcloud-server-bcd10d3dc52f2a6fa187895526eac05b48ddb7f9.zip
implement command maintenance:install
Diffstat (limited to 'console.php')
-rw-r--r--console.php32
1 files changed, 14 insertions, 18 deletions
diff --git a/console.php b/console.php
index 9b2475aa038..43f0563dc74 100644
--- a/console.php
+++ b/console.php
@@ -22,18 +22,14 @@
*/
use Symfony\Component\Console\Application;
+define('OC_CONSOLE', 1);
+
try {
require_once 'lib/base.php';
// set to run indefinitely if needed
set_time_limit(0);
- // Don't do anything if ownCloud has not been installed yet
- if (!\OC::$server->getConfig()->getSystemValue('installed', false)) {
- echo "Console can only be used once ownCloud has been installed" . PHP_EOL;
- exit(0);
- }
-
if (!OC::$CLI) {
echo "This script can be run from the command line only" . PHP_EOL;
exit(0);
@@ -54,23 +50,23 @@ try {
}
}
- // only load apps if no update is due,
- // else only core commands will be available
- if (!\OCP\Util::needUpgrade()) {
- // load all apps to get all api routes properly setup
- OC_App::loadApps();
- }
-
$defaults = new OC_Defaults;
$application = new Application($defaults->getName(), \OC_Util::getVersionString());
require_once 'core/register_command.php';
- if (!\OCP\Util::needUpgrade()) {
- foreach(OC_App::getAllApps() as $app) {
- $file = OC_App::getAppPath($app).'/appinfo/register_command.php';
- if(file_exists($file)) {
- require $file;
+ if (\OC::$server->getConfig()->getSystemValue('installed', false)) {
+ if (!\OCP\Util::needUpgrade()) {
+ OC_App::loadApps();
+ foreach (OC_App::getAllApps() as $app) {
+ $file = OC_App::getAppPath($app) . '/appinfo/register_command.php';
+ if (file_exists($file)) {
+ require $file;
+ }
}
+ } else {
+ echo "ownCloud or one of the apps require upgrade - only a limited number of commands are available" . PHP_EOL;
}
+ } else {
+ echo "ownCloud is not installed - only a limited number of commands are available" . PHP_EOL;
}
$application->run();
} catch (Exception $ex) {