Skip to content

Commit

Permalink
Update DeletedUsersCommand.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelien committed Jan 25, 2023
1 parent c79771c commit df34b41
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Command/DeletedUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,21 @@ private function updateCache(SymfonyStyle $io, string $path): CacheItemInterface
{
$usersDeletedCache = $this->cache->getItem(self::CACHE_KEY);

$list = array_map(fn ($line) => (int) trim($line), file($path, \FILE_IGNORE_NEW_LINES | \FILE_SKIP_EMPTY_LINES));
$list = [];

$resource = @fopen($path, 'r');
if (false !== $resource) {
while (($line = fgets($resource, 512)) !== false) {
$list[] = (int) trim($line);
}
fclose($resource);
}

$usersDeletedCache->set($list);

$this->cache->save($usersDeletedCache);

$io->note(sprintf('Deleted users: %d', \count($list)));
$io->note(sprintf('%d deleted users', \count($list)));

return $usersDeletedCache;
}
Expand Down

0 comments on commit df34b41

Please sign in to comment.