Cleanup error generation in base.php

This commit is contained in:
Bart Visscher 2013-07-16 22:36:39 +02:00
parent 7d86e262e1
commit 49fca86f3c
1 changed files with 8 additions and 20 deletions

View File

@ -124,10 +124,9 @@ class OC {
OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/'); OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/');
OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/'); OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/');
} else { } else {
echo('3rdparty directory not found! Please put the ownCloud 3rdparty' throw new Exception('3rdparty directory not found! Please put the ownCloud 3rdparty'
.' folder in the ownCloud folder or the folder above.' .' folder in the ownCloud folder or the folder above.'
.' You can also configure the location in the config.php file.'); .' You can also configure the location in the config.php file.');
exit;
} }
// search the apps folder // search the apps folder
$config_paths = OC_Config::getValue('apps_paths', array()); $config_paths = OC_Config::getValue('apps_paths', array());
@ -150,9 +149,8 @@ class OC {
} }
if (empty(OC::$APPSROOTS)) { if (empty(OC::$APPSROOTS)) {
echo('apps directory not found! Please put the ownCloud apps folder in the ownCloud folder' throw new Exception('apps directory not found! Please put the ownCloud apps folder in the ownCloud folder'
.' or the folder above. You can also configure the location in the config.php file.'); .' or the folder above. You can also configure the location in the config.php file.');
exit;
} }
$paths = array(); $paths = array();
foreach (OC::$APPSROOTS as $path) { foreach (OC::$APPSROOTS as $path) {
@ -174,14 +172,11 @@ 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();
$tmpl = new OC_Template('', 'error', 'guest'); OC_Template::printErrorPage(
$tmpl->assign('errors', array(1 => array( "Can't write into config directory 'config'",
'error' => "Can't write into config directory 'config'", 'This can usually be fixed by '
'hint' => 'This can usually be fixed by '
.'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the config directory</a>.' .'<a href="' . $defaults->getDocBaseUrl() . '/server/5.0/admin_manual/installation/installation_source.html#set-the-directory-permissions" target="_blank">giving the webserver write access to the config directory</a>.'
))); );
$tmpl->printPage();
exit();
} }
} }
@ -223,10 +218,7 @@ class OC {
header('Retry-After: 120'); header('Retry-After: 120');
// render error page // render error page
$tmpl = new OC_Template('', 'error', 'guest'); OC_Template::printErrorPage('ownCloud is in maintenance mode');
$tmpl->assign('errors', array(1 => array('error' => 'ownCloud is in maintenance mode')));
$tmpl->printPage();
exit();
} }
} }
@ -305,11 +297,7 @@ class OC {
$error = 'Session could not be initialized. Please contact your '; $error = 'Session could not be initialized. Please contact your ';
$error .= 'system administrator'; $error .= 'system administrator';
$tmpl = new OC_Template('', 'error', 'guest'); OC_Template::printErrorPage($error);
$tmpl->assign('errors', array(1 => array('error' => $error)));
$tmpl->printPage();
exit();
} }
$sessionLifeTime = self::getSessionLifeTime(); $sessionLifeTime = self::getSessionLifeTime();