Skip to content

Commit

Permalink
More updates to bulk tester script.
Browse files Browse the repository at this point in the history
  • Loading branch information
mckeownp committed Dec 11, 2024
1 parent be10b55 commit fa10f21
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions classes/cache_purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ public function key_count_by_course(array $contextids) {
//print_r($keys);
$pattern = '/_courseid_(\d+)_/';
foreach ($keys as $key) {
preg_match($pattern, $key, $match);
$courseid = $match[1];
if (array_key_exists($courseid, $coursetocontext)) {
$contextid = $coursetocontext[$courseid];
$contextcounts[$contextid] += 1;
}
$found = preg_match($pattern, $key, $match);
if ($found) {
$courseid = $match[1];
if (array_key_exists($courseid, $coursetocontext)) {
$contextid = $coursetocontext[$courseid];
$contextcounts[$contextid] += 1;
}
} // Not found so ignore.
}
// go through all keys and count by context...
return $contextcounts;
Expand Down

0 comments on commit fa10f21

Please sign in to comment.