diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-01-25 15:23:54 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-01-25 15:23:54 +0100 |
commit | 3be505f9c25926ea75421e91b3609f60b8617e95 (patch) | |
tree | 6e642029b166909f4c04bb10600fba8c08807ac3 /apps/settings/lib/SetupChecks | |
parent | 67541f21f6e4ee304d20cbf6510528e16d1e4ed6 (diff) | |
download | nextcloud-server-3be505f9c25926ea75421e91b3609f60b8617e95.tar.gz nextcloud-server-3be505f9c25926ea75421e91b3609f60b8617e95.zip |
Rename to "Push service" and enable on all instances to avoid trouble
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/settings/lib/SetupChecks')
-rw-r--r-- | apps/settings/lib/SetupChecks/PushService.php (renamed from apps/settings/lib/SetupChecks/FairUseOfFreePushService.php) | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/settings/lib/SetupChecks/FairUseOfFreePushService.php b/apps/settings/lib/SetupChecks/PushService.php index 431d1be4d6a..3f9f99380e8 100644 --- a/apps/settings/lib/SetupChecks/FairUseOfFreePushService.php +++ b/apps/settings/lib/SetupChecks/PushService.php @@ -25,22 +25,26 @@ declare(strict_types=1); */ namespace OCA\Settings\SetupChecks; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; use OCP\IL10N; use OCP\Notification\IManager; use OCP\SetupCheck\ISetupCheck; use OCP\SetupCheck\SetupResult; +use OCP\Support\Subscription\IRegistry; -class FairUseOfFreePushService implements ISetupCheck { +class PushService implements ISetupCheck { public function __construct( private IL10N $l10n, private IConfig $config, private IManager $notificationsManager, + private IRegistry $subscriptionRegistry, + private ITimeFactory $timeFactory, ) { } public function getName(): string { - return $this->l10n->t('Free push service'); + return $this->l10n->t('Push service'); } public function getCategory(): string { @@ -52,7 +56,7 @@ class FairUseOfFreePushService implements ISetupCheck { */ private function isFairUseOfFreePushService(): bool { $rateLimitReached = (int) $this->config->getAppValue('notifications', 'rate_limit_reached', '0'); - if ($rateLimitReached >= (time() - 7 * 24 * 3600)) { + if ($rateLimitReached >= ($this->timeFactory->now()->getTimestamp() - 7 * 24 * 3600)) { // Notifications app is showing a message already return true; } @@ -60,8 +64,12 @@ class FairUseOfFreePushService implements ISetupCheck { } public function run(): SetupResult { + if ($this->subscriptionRegistry->delegateHasValidSubscription()) { + return SetupResult::success($this->l10n->t('Valid enterprise license')); + } + if ($this->isFairUseOfFreePushService()) { - return SetupResult::success(); + return SetupResult::success($this->l10n->t('Free push service')); } return SetupResult::error( |