Merge pull request #6030 from owncloud/cli-errors

provide more cli friendly error messages when in cli mode
This commit is contained in:
icewind1991 2013-11-25 07:06:48 -08:00
commit 019f3299b0
1 changed files with 21 additions and 6 deletions

View File

@ -178,6 +178,13 @@ class OC {
if (file_exists(OC::$SERVERROOT . "/config/config.php") if (file_exists(OC::$SERVERROOT . "/config/config.php")
and !is_writable(OC::$SERVERROOT . "/config/config.php")) { and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
$defaults = new OC_Defaults(); $defaults = new OC_Defaults();
if (self::$CLI) {
echo "Can't write into config directory!\n";
echo "This can usually be fixed by giving the webserver write access to the config directory\n";
echo "\n";
echo "See " . \OC_Helper::linkToDocs('admin-dir_permissions') . "\n";
exit;
} else {
OC_Template::printErrorPage( OC_Template::printErrorPage(
"Can't write into config directory!", "Can't write into config directory!",
'This can usually be fixed by ' 'This can usually be fixed by '
@ -185,6 +192,7 @@ class OC {
); );
} }
} }
}
public static function checkInstalled() { public static function checkInstalled() {
// Redirect to installer if not installed // Redirect to installer if not installed
@ -480,7 +488,14 @@ class OC {
$errors = OC_Util::checkServer(); $errors = OC_Util::checkServer();
if (count($errors) > 0) { if (count($errors) > 0) {
if (self::$CLI) {
foreach ($errors as $error) {
echo $error['error']."\n";
echo $error['hint'] . "\n\n";
}
} else {
OC_Template::printGuestPage('', 'error', array('errors' => $errors)); OC_Template::printGuestPage('', 'error', array('errors' => $errors));
}
exit; exit;
} }