diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-12-17 10:48:29 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-02-10 09:51:31 +0100 |
commit | e23c67b0fd535f553051355fe50986515aebf191 (patch) | |
tree | fb1a6ef0f9d2e402db8d8ce02ffafbbdd41efc81 /console.php | |
parent | 3350d62b751834e933586f9b72adcc2e24771ee3 (diff) | |
download | nextcloud-server-e23c67b0fd535f553051355fe50986515aebf191.tar.gz nextcloud-server-e23c67b0fd535f553051355fe50986515aebf191.zip |
occ command can only be called from ownCloud root directory
* this changes into the ownCloud root directory and then should run just fine
* avoids weird error messages that are caused by this
Diffstat (limited to 'console.php')
-rw-r--r-- | console.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/console.php b/console.php index 8bfbabf2a03..ab845aced50 100644 --- a/console.php +++ b/console.php @@ -64,6 +64,16 @@ try { } } + $oldWorkingDir = getcwd(); + if ($oldWorkingDir === false) { + echo "This script can be run from the ownCloud root directory only." . PHP_EOL; + echo "Can't determine current working dir - the script will continue to work but be aware of the above fact." . PHP_EOL; + } else if ($oldWorkingDir !== __DIR__ && !chdir(__DIR__)) { + echo "This script can be run from the ownCloud root directory only." . PHP_EOL; + echo "Can't change to ownCloud root diretory." . PHP_EOL; + exit(1); + } + $application = new Application(\OC::$server->getConfig()); $application->loadCommands(new ConsoleOutput()); $application->run(); |