status.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Andreas Fischer <bantu@owncloud.com>
  6. * @author Christopher Schäpers <kondou@ts.unde.re>
  7. * @author Frank Karlitschek <frank@karlitschek.de>
  8. * @author Joas Schilling <coding@schilljs.com>
  9. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  10. * @author Julius Härtl <jus@bitgrid.net>
  11. * @author Kristof Provost <github@sigsegv.be>
  12. * @author Lukas Reschke <lukas@statuscode.ch>
  13. * @author martin.mattel@diemattels.at <martin.mattel@diemattels.at>
  14. * @author Masaki Kawabata Neto <masaki.kawabata@gmail.com>
  15. * @author Morris Jobke <hey@morrisjobke.de>
  16. * @author Roeland Jago Douma <roeland@famdouma.nl>
  17. *
  18. * @license AGPL-3.0
  19. *
  20. * This code is free software: you can redistribute it and/or modify
  21. * it under the terms of the GNU Affero General Public License, version 3,
  22. * as published by the Free Software Foundation.
  23. *
  24. * This program is distributed in the hope that it will be useful,
  25. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. * GNU Affero General Public License for more details.
  28. *
  29. * You should have received a copy of the GNU Affero General Public License, version 3,
  30. * along with this program. If not, see <http://www.gnu.org/licenses/>
  31. *
  32. */
  33. require_once __DIR__ . '/lib/versioncheck.php';
  34. try {
  35. require_once __DIR__ . '/lib/base.php';
  36. $systemConfig = \OC::$server->getSystemConfig();
  37. $installed = (bool) $systemConfig->getValue('installed', false);
  38. $maintenance = (bool) $systemConfig->getValue('maintenance', false);
  39. # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
  40. # for description and defaults
  41. $defaults = new \OCP\Defaults();
  42. $values = [
  43. 'installed' => $installed,
  44. 'maintenance' => $maintenance,
  45. 'needsDbUpgrade' => \OCP\Util::needUpgrade(),
  46. 'version' => implode('.', \OCP\Util::getVersion()),
  47. 'versionstring' => OC_Util::getVersionString(),
  48. 'edition' => '',
  49. 'productname' => $defaults->getName(),
  50. 'extendedSupport' => \OCP\Util::hasExtendedSupport()
  51. ];
  52. if (OC::$CLI) {
  53. print_r($values);
  54. } else {
  55. header('Access-Control-Allow-Origin: *');
  56. header('Content-Type: application/json');
  57. echo json_encode($values);
  58. }
  59. } catch (Exception $ex) {
  60. http_response_code(500);
  61. \OC::$server->getLogger()->logException($ex, ['app' => 'remote']);
  62. }