diff options
Diffstat (limited to 'apps/updatenotification/lib/Controller')
-rw-r--r-- | apps/updatenotification/lib/Controller/APIController.php | 19 | ||||
-rw-r--r-- | apps/updatenotification/lib/Controller/AdminController.php | 5 |
2 files changed, 14 insertions, 10 deletions
diff --git a/apps/updatenotification/lib/Controller/APIController.php b/apps/updatenotification/lib/Controller/APIController.php index c96a5101e0f..4360d814dd2 100644 --- a/apps/updatenotification/lib/Controller/APIController.php +++ b/apps/updatenotification/lib/Controller/APIController.php @@ -26,8 +26,7 @@ use OCP\L10N\IFactory; */ class APIController extends OCSController { - /** @var string */ - protected $language; + protected ?string $language = null; /** * List of apps that were in the appstore but are now shipped and don't have @@ -95,7 +94,7 @@ class APIController extends OCSController { $this->appFetcher->setVersion($newVersion, 'future-apps.json', false); // Apps available on the app store for that version - $availableApps = array_map(static function (array $app) { + $availableApps = array_map(static function (array $app): string { return $app['id']; }, $this->appFetcher->get()); @@ -106,8 +105,6 @@ class APIController extends OCSController { ], Http::STATUS_NOT_FOUND); } - $this->language = $this->l10nFactory->getUserLanguage($this->userSession->getUser()); - // Ignore apps that are deployed from git $installedApps = array_filter($installedApps, function (string $appId) { try { @@ -139,14 +136,20 @@ class APIController extends OCSController { */ protected function getAppDetails(string $appId): array { $app = $this->appManager->getAppInfo($appId, false, $this->language); - /** @var ?string $name */ - $name = $app['name']; + $name = $app['name'] ?? $appId; return [ 'appId' => $appId, - 'appName' => $name ?? $appId, + 'appName' => $name, ]; } + protected function getLanguage(): string { + if ($this->language === null) { + $this->language = $this->l10nFactory->getUserLanguage($this->userSession->getUser()); + } + return $this->language; + } + /** * Get changelog entry for an app * diff --git a/apps/updatenotification/lib/Controller/AdminController.php b/apps/updatenotification/lib/Controller/AdminController.php index 6e7f9935d93..26745948890 100644 --- a/apps/updatenotification/lib/Controller/AdminController.php +++ b/apps/updatenotification/lib/Controller/AdminController.php @@ -4,6 +4,7 @@ declare(strict_types=1); /** * SPDX-FileCopyrightText: 2016 ownCloud, Inc. + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-only */ namespace OCA\UpdateNotification\Controller; @@ -36,8 +37,8 @@ class AdminController extends Controller { parent::__construct($appName, $request); } - private function isUpdaterEnabled() { - return !$this->config->getSystemValue('upgrade.disable-web', false); + private function isUpdaterEnabled(): bool { + return !$this->config->getSystemValueBool('upgrade.disable-web'); } /** |