1
0

status.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. }