From be3cf85656ca72bd221f3787ac1c60342fd25028 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Tue, 6 May 2025 19:41:56 +0200 Subject: [PATCH] refactor(updatenotification): use constant instead of variable Signed-off-by: Ferdinand Thiessen --- .../BackgroundJob/UpdateAvailableNotifications.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php b/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php index 49b5a44b85d..8879bb0c223 100644 --- a/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php +++ b/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php @@ -22,10 +22,15 @@ use OCP\Notification\IManager; use OCP\ServerVersion; class UpdateAvailableNotifications extends TimedJob { - protected $connectionNotifications = [3, 7, 14, 30]; - /** @var string[] */ - protected $users; + /** + * Numbers of failed updater connection to report error as notification. + * @var list + */ + protected const CONNECTION_NOTIFICATIONS = [3, 7, 14, 30]; + + /** @var ?string[] */ + protected $users = null; public function __construct( ITimeFactory $timeFactory, @@ -83,7 +88,7 @@ class UpdateAvailableNotifications extends TimedJob { $errors = 1 + $this->appConfig->getAppValueInt('update_check_errors', 0); $this->appConfig->setAppValueInt('update_check_errors', $errors); - if (\in_array($errors, $this->connectionNotifications, true)) { + if (\in_array($errors, self::CONNECTION_NOTIFICATIONS, true)) { $this->sendErrorNotifications($errors); } } elseif (\is_array($status)) {