status.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. require_once __DIR__ . '/lib/versioncheck.php';
  8. use Psr\Log\LoggerInterface;
  9. try {
  10. require_once __DIR__ . '/lib/base.php';
  11. $systemConfig = \OC::$server->getSystemConfig();
  12. $installed = (bool)$systemConfig->getValue('installed', false);
  13. $maintenance = (bool)$systemConfig->getValue('maintenance', false);
  14. # see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
  15. # for description and defaults
  16. $defaults = new \OCP\Defaults();
  17. $values = [
  18. 'installed' => $installed,
  19. 'maintenance' => $maintenance,
  20. 'needsDbUpgrade' => \OCP\Util::needUpgrade(),
  21. 'version' => implode('.', \OCP\Util::getVersion()),
  22. 'versionstring' => \OCP\Server::get(\OCP\ServerVersion::class)->getVersionString(),
  23. 'edition' => '',
  24. 'productname' => $defaults->getProductName(),
  25. 'extendedSupport' => \OCP\Util::hasExtendedSupport()
  26. ];
  27. if (OC::$CLI) {
  28. print_r($values);
  29. } else {
  30. header('Access-Control-Allow-Origin: *');
  31. header('Content-Type: application/json');
  32. echo json_encode($values);
  33. }
  34. } catch (Exception $ex) {
  35. http_response_code(500);
  36. \OCP\Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'remote','exception' => $ex]);
  37. }