diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2023-11-07 14:21:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-07 14:21:47 +0100 |
commit | 84d2a9b3d043ddcb7e0894d771d661559e7b1955 (patch) | |
tree | 67bd3094a8abbdf81e6f1c028ee72f630b13a6bc /apps/settings/lib/SetupChecks/MemcacheConfigured.php | |
parent | d4830051c5b80f65066b7c0413530bd15c911473 (diff) | |
parent | 00d3856b92aa533777907b990d76e98bb4d3c9dc (diff) | |
download | nextcloud-server-84d2a9b3d043ddcb7e0894d771d661559e7b1955.tar.gz nextcloud-server-84d2a9b3d043ddcb7e0894d771d661559e7b1955.zip |
Merge pull request #41134 from nextcloud/feat/migrate-more-setup-checks
Migrate checks to new SetupCheck API
Diffstat (limited to 'apps/settings/lib/SetupChecks/MemcacheConfigured.php')
-rw-r--r-- | apps/settings/lib/SetupChecks/MemcacheConfigured.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/apps/settings/lib/SetupChecks/MemcacheConfigured.php b/apps/settings/lib/SetupChecks/MemcacheConfigured.php new file mode 100644 index 00000000000..2cde18a25df --- /dev/null +++ b/apps/settings/lib/SetupChecks/MemcacheConfigured.php @@ -0,0 +1,60 @@ +<?php + +declare(strict_types=1); + +/** + * @copyright Copyright (c) 2023 Côme Chilliet <come.chilliet@nextcloud.com> + * + * @author Côme Chilliet <come.chilliet@nextcloud.com> + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +namespace OCA\Settings\SetupChecks; + +use OCP\IConfig; +use OCP\IL10N; +use OCP\IURLGenerator; +use OCP\SetupCheck\ISetupCheck; +use OCP\SetupCheck\SetupResult; + +class MemcacheConfigured implements ISetupCheck { + public function __construct( + private IL10N $l10n, + private IConfig $config, + private IURLGenerator $urlGenerator, + ) { + } + + public function getName(): string { + return $this->l10n->t('Memcache'); + } + + public function getCategory(): string { + return 'system'; + } + + public function run(): SetupResult { + if ($this->config->getSystemValue('memcache.local', null) !== null) { + return SetupResult::success($this->l10n->t('Configured')); + } else { + return SetupResult::info( + $this->l10n->t('No memory cache has been configured. To enhance performance, please configure a memcache, if available.'), + $this->urlGenerator->linkToDocs('admin-performance') + ); + } + } +} |