index.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.4.0 is used, this has to happen here
  28. // because base.php will already use 5.4 syntax.
  29. if (version_compare(PHP_VERSION, '5.4.0') === -1) {
  30. echo 'This version of ownCloud requires at least PHP 5.4.0<br/>';
  31. echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
  32. return;
  33. }
  34. // Show warning if PHP 7.1 is used as Nextcloud is not compatible with PHP 7.1 for now
  35. // @see https://github.com/nextcloud/docker-ci/issues/10
  36. if (version_compare(PHP_VERSION, '7.1.0') !== -1) {
  37. echo 'This version of Nextcloud is not compatible with PHP 7.1.<br/>';
  38. echo 'You are currently running ' . PHP_VERSION . '.';
  39. return;
  40. }
  41. try {
  42. require_once 'lib/base.php';
  43. OC::handleRequest();
  44. } catch(\OC\ServiceUnavailableException $ex) {
  45. \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
  46. //show the user a detailed error page
  47. OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
  48. OC_Template::printExceptionErrorPage($ex);
  49. } catch (\OC\HintException $ex) {
  50. OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
  51. OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
  52. } catch (Exception $ex) {
  53. \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
  54. //show the user a detailed error page
  55. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  56. OC_Template::printExceptionErrorPage($ex);
  57. } catch (Error $ex) {
  58. \OC::$server->getLogger()->logException($ex, ['app' => 'index']);
  59. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  60. OC_Template::printExceptionErrorPage($ex);
  61. }