Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
Signed-off-by: szaimen <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Mar 25, 2022
1 parent e8122f2 commit 72ffab9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions apps/updatenotification/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,16 @@ private function getUserCount(): int {
$backendUsers = $backend->countUsers();
if ($backendUsers !== false) {
$userCount += $backendUsers;
} else {
// TODO what if the user count can't be determined?
$this->logger->warning('Can not determine user count for ' . get_class($backend), ['app' => 'updatenotification']);
}
}
}

$disabledUsers = $this->config->getUsersForUserValue('core', 'enabled', 'false');
$disabledUsersCount = count($disabledUsers);
$userCount = $userCount - $disabledUsersCount;

// Disabled users are not subtracted because they lengthen the overall update size, too
if ($userCount < 0) {
$userCount = 0;

// this should never happen
$this->logger->warning("Total user count was negative (users: $userCount, disabled: $disabledUsersCount)", ['app' => 'updatenotification']);
$this->logger->warning("Total user count was negative (users: $userCount)", ['app' => 'updatenotification']);
}

return $userCount;
Expand Down

0 comments on commit 72ffab9

Please sign in to comment.