1
0

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