aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2025-04-01 15:19:43 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-04-01 15:08:57 +0000
commit827eda699fa0bcb4092115c93be6dda2899f7144 (patch)
tree201ca19434d3962fb67fd100c001e62c07bb8118
parent0e5044701b06da259f6bcaff3b0e727e7384b7cd (diff)
downloadnextcloud-server-backport/51760/stable29.tar.gz
nextcloud-server-backport/51760/stable29.zip
fix(files_reminder): Replace error log by setup checkbackport/51760/stable29
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--apps/files_reminders/lib/AppInfo/Application.php2
-rw-r--r--apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php1
-rw-r--r--apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php37
3 files changed, 39 insertions, 1 deletions
diff --git a/apps/files_reminders/lib/AppInfo/Application.php b/apps/files_reminders/lib/AppInfo/Application.php
index 7adeefc3503..813fbd3ca22 100644
--- a/apps/files_reminders/lib/AppInfo/Application.php
+++ b/apps/files_reminders/lib/AppInfo/Application.php
@@ -59,5 +59,7 @@ class Application extends App implements IBootstrap {
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);
$context->registerEventListener(LoadAdditionalScriptsEvent::class, LoadAdditionalScriptsListener::class);
+
+ $context->registerSetupCheck(NeedNotificationsApp::class);
}
}
diff --git a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php
index 9a48ef9ce76..fe924f6a8a5 100644
--- a/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php
+++ b/apps/files_reminders/lib/Listener/LoadAdditionalScriptsListener.php
@@ -48,7 +48,6 @@ class LoadAdditionalScriptsListener implements IEventListener {
}
if (!$this->appManager->isEnabledForUser('notifications')) {
- $this->logger->info('Skipped registering the `files_reminders` app because the `notifications` app is disabled.', ['app' => 'files_reminders']);
return;
}
diff --git a/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php b/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php
new file mode 100644
index 00000000000..2fc80094152
--- /dev/null
+++ b/apps/files_reminders/lib/SetupChecks/NeedNotificationsApp.php
@@ -0,0 +1,37 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCA\DAV\SetupChecks;
+
+use OCP\App\IAppManager;
+use OCP\SetupCheck\ISetupCheck;
+use OCP\SetupCheck\SetupResult;
+
+class NeedNotificationsApp implements ISetupCheck {
+ public function __construct(
+ private IAppManager $appManager,
+ ) {
+ }
+
+ public function getName(): string {
+ return $this->l10n->t('Files reminder');
+ }
+
+ public function getCategory(): string {
+ return 'system';
+ }
+
+ public function run(): SetupResult {
+ if ($this->appManager->isInstalled('notifications')) {
+ return SetupResult::success($this->l10n->t('This files_reminder can work properly.'));
+ } else {
+ return SetupResult::warning($this->l10n->t('The files_reminder app needs the notification app to work properly. You should either enable notifications or disable files_reminder.'));
+ }
+ }
+}