summaryrefslogtreecommitdiffstats
path: root/console.php
diff options
context:
space:
mode:
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) {