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