You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

status.php 2.5KB

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 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. use Psr\Log\LoggerInterface;
  36. try {
  37. require_once __DIR__ . '/lib/base.php';
  38. $systemConfig = \OC::$server->getSystemConfig();
  39. $installed = (bool) $systemConfig->getValue('installed', false);
  40. $maintenance = (bool) $systemConfig->getValue('maintenance', false);
  41. # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
  42. # for description and defaults
  43. $defaults = new \OCP\Defaults();
  44. $values = [
  45. 'installed' => $installed,
  46. 'maintenance' => $maintenance,
  47. 'needsDbUpgrade' => \OCP\Util::needUpgrade(),
  48. 'version' => implode('.', \OCP\Util::getVersion()),
  49. 'versionstring' => OC_Util::getVersionString(),
  50. 'edition' => '',
  51. 'productname' => $defaults->getProductName(),
  52. 'extendedSupport' => \OCP\Util::hasExtendedSupport()
  53. ];
  54. if (OC::$CLI) {
  55. print_r($values);
  56. } else {
  57. header('Access-Control-Allow-Origin: *');
  58. header('Content-Type: application/json');
  59. echo json_encode($values);
  60. }
  61. } catch (Exception $ex) {
  62. http_response_code(500);
  63. \OCP\Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'remote','exception' => $ex]);
  64. }