0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-26 23:18:39 +00:00
nextcloud_server/status.php
2024-09-20 14:53:34 +02:00

43 lines
1.3 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
require_once __DIR__ . '/lib/versioncheck.php';
use Psr\Log\LoggerInterface;
try {
require_once __DIR__ . '/lib/base.php';
$systemConfig = \OC::$server->getSystemConfig();
$installed = (bool)$systemConfig->getValue('installed', false);
$maintenance = (bool)$systemConfig->getValue('maintenance', false);
# see core/lib/private/legacy/defaults.php and core/themes/example/defaults.php
# for description and defaults
$defaults = new \OCP\Defaults();
$values = [
'installed' => $installed,
'maintenance' => $maintenance,
'needsDbUpgrade' => \OCP\Util::needUpgrade(),
'version' => implode('.', \OCP\Util::getVersion()),
'versionstring' => \OCP\Server::get(\OCP\ServerVersion::class)->getVersionString(),
'edition' => '',
'productname' => $defaults->getProductName(),
'extendedSupport' => \OCP\Util::hasExtendedSupport()
];
if (OC::$CLI) {
print_r($values);
} else {
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
echo json_encode($values);
}
} catch (Exception $ex) {
http_response_code(500);
\OCP\Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'remote','exception' => $ex]);
}