Merge pull request #21251 from owncloud/make-occ-more-error-proof

occ command can only be called from ownCloud root directory
This commit is contained in:
Thomas Müller 2015-12-17 15:45:32 +01:00
commit a9ad5c7b6b
1 changed files with 10 additions and 0 deletions

View File

@ -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();