index.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  6. * @author Lukas Reschke <lukas@statuscode.ch>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Robin Appelman <robin@icewind.nl>
  9. * @author Thomas Müller <thomas.mueller@tmit.eu>
  10. * @author Vincent Petry <pvince81@owncloud.com>
  11. *
  12. * @license AGPL-3.0
  13. *
  14. * This code is free software: you can redistribute it and/or modify
  15. * it under the terms of the GNU Affero General Public License, version 3,
  16. * as published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License, version 3,
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>
  25. *
  26. */
  27. // Show warning if a PHP version below 5.6.0 is used, this has to happen here
  28. // because base.php will already use 5.6 syntax.
  29. if (version_compare(PHP_VERSION, '5.6.0') === -1) {
  30. echo 'This version of Nextcloud requires at least PHP 5.6.0<br/>';
  31. echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
  32. return;
  33. }
  34. try {
  35. require_once __DIR__ . '/lib/base.php';
  36. OC::handleRequest();
  37. } catch(\OC\ServiceUnavailableException $ex) {
  38. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  39. //show the user a detailed error page
  40. OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
  41. OC_Template::printExceptionErrorPage($ex);
  42. } catch (\OC\HintException $ex) {
  43. OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
  44. OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
  45. } catch (Exception $ex) {
  46. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  47. //show the user a detailed error page
  48. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  49. OC_Template::printExceptionErrorPage($ex);
  50. } catch (Error $ex) {
  51. \OC::$server->getLogger()->logException($ex, array('app' => 'index'));
  52. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  53. OC_Template::printExceptionErrorPage($ex);
  54. }