summaryrefslogtreecommitdiffstats
path: root/public.php
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-06-10 13:45:19 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-06-10 13:45:19 +0200
commit8dc6bdd96b9088b87fe8d11346338343135c77e7 (patch)
tree2f969c8b9a0572d7e4648c9ad8ff2524bdaf27af /public.php
parentc0bdbd9d81eb22ded95cd7ea9b26a0c36cfa1be0 (diff)
downloadnextcloud-server-8dc6bdd96b9088b87fe8d11346338343135c77e7.tar.gz
nextcloud-server-8dc6bdd96b9088b87fe8d11346338343135c77e7.zip
clean up usage of DatabaseSetupException and catch Exceptions in entrypoints
Diffstat (limited to 'public.php')
-rw-r--r--public.php42
1 files changed, 26 insertions, 16 deletions
diff --git a/public.php b/public.php
index 3d7fd378af4..0154b59cce3 100644
--- a/public.php
+++ b/public.php
@@ -1,21 +1,31 @@
<?php
$RUNTIME_NOAPPS = true;
-require_once 'lib/base.php';
-OC::checkMaintenanceMode();
-if (!isset($_GET['service'])) {
- header('HTTP/1.0 404 Not Found');
- exit;
-}
-$file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($_GET['service']));
-if(is_null($file)) {
- header('HTTP/1.0 404 Not Found');
- exit;
-}
-$parts=explode('/', $file, 2);
-$app=$parts[0];
+try {
-OC_Util::checkAppEnabled($app);
-OC_App::loadApp($app);
+ require_once 'lib/base.php';
+ OC::checkMaintenanceMode();
+ if (!isset($_GET['service'])) {
+ header('HTTP/1.0 404 Not Found');
+ exit;
+ }
+ $file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($_GET['service']));
+ if(is_null($file)) {
+ header('HTTP/1.0 404 Not Found');
+ exit;
+ }
-require_once OC_App::getAppPath($app) .'/'. $parts[1];
+ $parts=explode('/', $file, 2);
+ $app=$parts[0];
+
+ OC_Util::checkAppEnabled($app);
+ OC_App::loadApp($app);
+
+ require_once OC_App::getAppPath($app) .'/'. $parts[1];
+
+} catch (Exception $ex) {
+ //show the user a detailed error page
+ OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
+ \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL);
+ OC_Template::printExceptionErrorPage($ex);
+} \ No newline at end of file