aboutsummaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2013-07-21 11:20:30 -0700
committerBart Visscher <bartv@thisnet.nl>2013-07-21 11:20:30 -0700
commit639097db5945f0631f69441abfa9eaec610d4d8e (patch)
tree98d7c1df5dcc29f130ad90c87749be12e5da6aa0 /lib/base.php
parent9bf12da7504a04a05edf02286d9777d2235e7274 (diff)
parent11f28d78805674ea06ef9227cf922140bff4a4ae (diff)
downloadnextcloud-server-639097db5945f0631f69441abfa9eaec610d4d8e.tar.gz
nextcloud-server-639097db5945f0631f69441abfa9eaec610d4d8e.zip
Merge pull request #4092 from owncloud/base-better-errors
Generate better errors in base.php
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php29
1 files changed, 9 insertions, 20 deletions
diff --git a/lib/base.php b/lib/base.php
index 53aa7b09fd5..1ff462819db 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -124,10 +124,9 @@ class OC {
OC::$THIRDPARTYWEBROOT = rtrim(dirname(OC::$WEBROOT), '/');
OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/');
} 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.'
.' You can also configure the location in the config.php file.');
- exit;
}
// search the apps folder
$config_paths = OC_Config::getValue('apps_paths', array());
@@ -150,9 +149,8 @@ class OC {
}
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.');
- exit;
}
$paths = array();
foreach (OC::$APPSROOTS as $path) {
@@ -174,14 +172,11 @@ class OC {
if (file_exists(OC::$SERVERROOT . "/config/config.php")
and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
$defaults = new OC_Defaults();
- $tmpl = new OC_Template('', 'error', 'guest');
- $tmpl->assign('errors', array(1 => array(
- 'error' => "Can't write into config directory 'config'",
- 'hint' => 'This can usually be fixed by '
+ OC_Template::printErrorPage(
+ "Can't write into config directory 'config'",
+ '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>.'
- )));
- $tmpl->printPage();
- exit();
+ );
}
}
@@ -223,10 +218,7 @@ class OC {
header('Retry-After: 120');
// render error page
- $tmpl = new OC_Template('', 'error', 'guest');
- $tmpl->assign('errors', array(1 => array('error' => 'ownCloud is in maintenance mode')));
- $tmpl->printPage();
- exit();
+ OC_Template::printErrorPage('ownCloud is in maintenance mode');
}
}
@@ -305,11 +297,7 @@ class OC {
$error = 'Session could not be initialized. Please contact your ';
$error .= 'system administrator';
- $tmpl = new OC_Template('', 'error', 'guest');
- $tmpl->assign('errors', array(1 => array('error' => $error)));
- $tmpl->printPage();
-
- exit();
+ OC_Template::printErrorPage($error);
}
$sessionLifeTime = self::getSessionLifeTime();
@@ -370,6 +358,7 @@ class OC {
self::$loader->registerPrefix('Symfony\\Component\\Routing', 'symfony/routing');
self::$loader->registerPrefix('Sabre\\VObject', '3rdparty');
self::$loader->registerPrefix('Sabre_', '3rdparty');
+ self::$loader->registerPrefix('Patchwork', '3rdparty');
spl_autoload_register(array(self::$loader, 'load'));
// set some stuff