diff --git a/lib/CheckQuota.php b/lib/CheckQuota.php index c13faf6..df4719b 100644 --- a/lib/CheckQuota.php +++ b/lib/CheckQuota.php @@ -88,7 +88,7 @@ public function check(string $userId): void { $usage = $this->getRelativeQuotaUsage($userId); - if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', 95)) { + if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', '95')) { if ($this->shouldIssueWarning($userId, 'alert')) { $this->issueWarning($userId, $usage); if ($this->config->getAppValue('quota_warning', 'alert_email', 'no') === 'yes') { @@ -96,7 +96,7 @@ public function check(string $userId): void { } } $this->updateLastWarning($userId, 'alert'); - } elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', 90)) { + } elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', '90')) { if ($this->shouldIssueWarning($userId, 'warning')) { $this->issueWarning($userId, $usage); if ($this->config->getAppValue('quota_warning', 'warning_email', 'no') === 'yes') { @@ -105,7 +105,7 @@ public function check(string $userId): void { } $this->updateLastWarning($userId, 'warning'); $this->removeLastWarning($userId, 'alert'); - } elseif ($usage > $this->config->getAppValue('quota_warning', 'info_percentage', 85)) { + } elseif ($usage > $this->config->getAppValue('quota_warning', 'info_percentage', '85')) { if ($this->shouldIssueWarning($userId, 'info')) { $this->issueWarning($userId, $usage); if ($this->config->getAppValue('quota_warning', 'info_email', 'no') === 'yes') { @@ -190,7 +190,7 @@ protected function sendEmail(string $userId, float $percentage): void { $link = $this->config->getAppValue('quota_warning', 'plan_management_url'); - $help = $l->t('You are using more than %d%% of your storage quota. Try to free up some space by deleting old files you don\'t need anymore.', $percentage); + $help = $l->t('You are using more than %d%% of your storage quota. Try to free up some space by deleting old files you don\'t need anymore.', [$percentage]); if ($link !== '') { $emailTemplate->addBodyText( htmlspecialchars($help . ' ' . $l->t('Or click the following button for options to change your data plan.')), @@ -251,7 +251,7 @@ protected function shouldIssueWarning(string $userId, string $level): bool { return true; } - $days = (int) $this->config->getAppValue('quota_warning', 'repeat_warning', 7); + $days = (int) $this->config->getAppValue('quota_warning', 'repeat_warning', '7'); if ($days <= 0) { return false; diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 7aa7c24..538744c 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -91,14 +91,14 @@ public function prepare(INotification $notification, string $languageCode): INot } $usage = $this->checkQuota->getRelativeQuotaUsage($notification->getUser()); - if ($usage < $this->config->getAppValue('quota_warning', 'info_percentage', 85)) { + if ($usage < $this->config->getAppValue('quota_warning', 'info_percentage', '85')) { // User is not in danger zone anymore throw new AlreadyProcessedException(); } - if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', 95)) { + if ($usage > $this->config->getAppValue('quota_warning', 'alert_percentage', '95')) { $imagePath = $this->url->imagePath(Application::APP_ID, 'app-alert.svg'); - } elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', 90)) { + } elseif ($usage > $this->config->getAppValue('quota_warning', 'warning_percentage', '90')) { $imagePath = $this->url->imagePath(Application::APP_ID, 'app-warning.svg'); } else { $imagePath = $this->url->imagePath(Application::APP_ID, 'app-dark.svg'); diff --git a/lib/Settings.php b/lib/Settings.php index 0437311..3348a03 100644 --- a/lib/Settings.php +++ b/lib/Settings.php @@ -39,14 +39,14 @@ public function __construct(IConfig $config) { public function getForm(): TemplateResponse { $response = new TemplateResponse('quota_warning', 'settings'); $response->setParams([ - 'info_percentage' => $this->config->getAppValue('quota_warning', 'info_percentage', 85), + 'info_percentage' => $this->config->getAppValue('quota_warning', 'info_percentage', '85'), 'info_email' => $this->config->getAppValue('quota_warning', 'info_email', 'no') === 'yes', - 'warning_percentage' => $this->config->getAppValue('quota_warning', 'warning_percentage', 90), + 'warning_percentage' => $this->config->getAppValue('quota_warning', 'warning_percentage', '90'), 'warning_email' => $this->config->getAppValue('quota_warning', 'warning_email', 'no') === 'yes', - 'alert_percentage' => $this->config->getAppValue('quota_warning', 'alert_percentage', 95), + 'alert_percentage' => $this->config->getAppValue('quota_warning', 'alert_percentage', '95'), 'alert_email' => $this->config->getAppValue('quota_warning', 'alert_email', 'no') === 'yes', 'plan_management_url' => $this->config->getAppValue('quota_warning', 'plan_management_url'), - 'repeat_warning' => $this->config->getAppValue('quota_warning', 'repeat_warning', 7), + 'repeat_warning' => $this->config->getAppValue('quota_warning', 'repeat_warning', '7'), ]); return $response;