summaryrefslogtreecommitdiffstats
path: root/lib/private/console
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/console')
-rw-r--r--lib/private/console/application.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/private/console/application.php b/lib/private/console/application.php
index 55c817d497f..e6d8677b72e 100644
--- a/lib/private/console/application.php
+++ b/lib/private/console/application.php
@@ -48,25 +48,31 @@ class Application {
/**
* @param OutputInterface $output
+ * @throws \Exception
*/
public function loadCommands(OutputInterface $output) {
// $application is required to be defined in the register_command scripts
$application = $this->application;
- require_once \OC::$SERVERROOT . '/core/register_command.php';
+ require_once __DIR__ . '/../../../core/register_command.php';
if ($this->config->getSystemValue('installed', false)) {
- if (!\OCP\Util::needUpgrade()) {
+ if (\OCP\Util::needUpgrade()) {
+ $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
+ $output->writeln("You may use your browser or the occ upgrade command to do the upgrade");
+ } elseif ($this->config->getSystemValue('maintenance', false)) {
+ $output->writeln("ownCloud is in maintenance mode - no app have been loaded");
+ } else {
OC_App::loadApps();
foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) {
$appPath = \OC_App::getAppPath($app);
+ if($appPath === false) {
+ continue;
+ }
\OC::$loader->addValidRoot($appPath);
$file = $appPath . '/appinfo/register_command.php';
if (file_exists($file)) {
require $file;
}
}
- } else {
- $output->writeln("ownCloud or one of the apps require upgrade - only a limited number of commands are available");
- $output->writeln("You may use your browser or the occ upgrade command to do the upgrade");
}
} else {
$output->writeln("ownCloud is not installed - only a limited number of commands are available");
@@ -85,6 +91,11 @@ class Application {
}
}
+ /**
+ * Sets whether to automatically exit after a command execution or not.
+ *
+ * @param bool $boolean Whether to automatically exit after a command execution or not
+ */
public function setAutoExit($boolean) {
$this->application->setAutoExit($boolean);
}