Skip to content

Commit

Permalink
Making suggested change and adding more test cases around it
Browse files Browse the repository at this point in the history
  • Loading branch information
snake14 committed Oct 20, 2024
1 parent 5a728e8 commit e36ff0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/Archive/ArchiveInvalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,13 @@ public function removeInvalidationsFromDistributedList($idSites, $pluginName = n
$list = new ReArchiveList();
$entries = $list->getAll();

// Make sure that idSites is an array to prevent typeError
$idSites = is_array($idSites) || $idSites === 'all' ? $idSites : (is_numeric($idSites) ? [$idSites] : []);

if ($idSites === 'all') {
$idSites = $this->getAllSitesId();
}

// Make sure that idSites is an array to prevent typeError
$idSites = is_array($idSites) ? $idSites : ($idSites !== true ? [$idSites] : []);

foreach ($entries as $index => $entry) {
$entry = @json_decode($entry, true);
if (empty($entry)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,13 @@ public function getRemoveInvalidationsFromDistributedListDifferentIdSiteValues()
[null, $expected],
[0, $expected],
['0', $expected],
['unexpectedString', $expected],
[2.2, $expected],
[123.45, $expected],
[false, $expected],
[true, $expected],
['false', $expected],
['true', $expected],
['all', []],
];
}
Expand Down

0 comments on commit e36ff0a

Please sign in to comment.