aboutsummaryrefslogtreecommitdiffstats
path: root/status.php
blob: e4d4bab7e45be9b3d138d518f317bf69796f54ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?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]);
}