index.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @author Frank Karlitschek <frank@owncloud.org>
  4. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  5. * @author Lukas Reschke <lukas@owncloud.com>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <icewind@owncloud.com>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Vincent Petry <pvince81@owncloud.com>
  10. *
  11. * @copyright Copyright (c) 2015, ownCloud, Inc.
  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. try {
  35. require_once 'lib/base.php';
  36. OC::handleRequest();
  37. } catch(\OC\ServiceUnavailableException $ex) {
  38. \OCP\Util::logException('index', $ex);
  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. \OCP\Util::logException('index', $ex);
  47. //show the user a detailed error page
  48. OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR);
  49. OC_Template::printExceptionErrorPage($ex);
  50. }