diff options
Diffstat (limited to 'status.php')
-rw-r--r-- | status.php | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/status.php b/status.php index 86f1f68dde1..e1b95d9396b 100644 --- a/status.php +++ b/status.php @@ -1,44 +1,43 @@ <?php + +declare(strict_types=1); + /** - * @author Andreas Fischer <bantu@owncloud.com> - * @author Christopher Schäpers <kondou@ts.unde.re> - * @author Frank Karlitschek <frank@owncloud.org> - * @author Jörn Friedrich Dreyer <jfd@butonic.de> - * @author Lukas Reschke <lukas@owncloud.com> - * @author Masaki Kawabata Neto <masaki.kawabata@gmail.com> - * @author Morris Jobke <hey@morrisjobke.de> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * + * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-License-Identifier: AGPL-3.0-only */ -try { +require_once __DIR__ . '/lib/versioncheck.php'; - require_once 'lib/base.php'; +use OC\SystemConfig; +use OCP\Defaults; +use OCP\Server; +use OCP\ServerVersion; +use OCP\Util; +use Psr\Log\LoggerInterface; - $systemConfig = \OC::$server->getSystemConfig(); +try { + require_once __DIR__ . '/lib/base.php'; + + $systemConfig = Server::get(SystemConfig::class); - $installed = $systemConfig->getValue('installed') == 1; - $maintenance = $systemConfig->getValue('maintenance', false); - $values=array( - 'installed'=>$installed, + $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 Defaults(); + $serverVersion = Server::get(ServerVersion::class); + $values = [ + 'installed' => $installed, 'maintenance' => $maintenance, - 'version'=>implode('.', \OCP\Util::getVersion()), - 'versionstring'=>OC_Util::getVersionString(), - 'edition'=>OC_Util::getEditionString()); + 'needsDbUpgrade' => Util::needUpgrade(), + 'version' => implode('.', $serverVersion->getVersion()), + 'versionstring' => $serverVersion->getVersionString(), + 'edition' => '', + 'productname' => $defaults->getProductName(), + 'extendedSupport' => Util::hasExtendedSupport() + ]; if (OC::$CLI) { print_r($values); } else { @@ -46,8 +45,7 @@ try { header('Content-Type: application/json'); echo json_encode($values); } - } catch (Exception $ex) { - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); - \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); + http_response_code(500); + Server::get(LoggerInterface::class)->error($ex->getMessage(), ['app' => 'remote','exception' => $ex]); } |