From 7388aa17bdc866bdb6f2573b2b77dcf97a507dfc Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Tue, 7 Jul 2026 21:27:27 +0100 Subject: [PATCH] fix psalm annoyances --- public/delete-inactive.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/delete-inactive.php b/public/delete-inactive.php index be6e2257..dd0ff403 100644 --- a/public/delete-inactive.php +++ b/public/delete-inactive.php @@ -43,17 +43,19 @@ if (!is_string($domain) || $domain === '' || !in_array($domain, list_domains_for # enumerate the inactive aliases; getList() is already restricted to the # admin's allowed domains, so this cannot reach other domains' aliases. -$handler = new AliasHandler(0, $username, $is_admin); +$handler = new AliasHandler(0, $username, (int) $is_admin); $handler->getList(array('domain' => $domain, 'active' => 0)); $inactive = $handler->result(); $deleted = 0; $skipped = 0; -foreach (array_keys($inactive) as $address) { + +foreach ($inactive as $address => $_) { + # delete each alias through its handler so per-alias checks (ownership, # protected/default aliases, mailbox aliases) are all honoured. - $one = new AliasHandler(0, $username, $is_admin); + $one = new AliasHandler(0, $username, (int) $is_admin); if ($one->init($address) && $one->delete()) { $deleted++; } else { @@ -61,9 +63,9 @@ foreach (array_keys($inactive) as $address) { } } -flash_info(Config::Lang_f('pDelete_inactive_success', $deleted)); +flash_info(Config::lang_f('pDelete_inactive_success', (string) $deleted)); if ($skipped > 0) { - flash_error(Config::Lang_f('pDelete_inactive_skipped', $skipped)); + flash_error(Config::lang_f('pDelete_inactive_skipped', (string) $skipped)); } header('Location: list-virtual.php?domain=' . urlencode($domain));