From 13c435230c89d1ffc1bee0cbb20d2eaf0f0b8fb4 Mon Sep 17 00:00:00 2001 From: Seth Shaw Date: Thu, 11 Apr 2024 20:23:52 +0000 Subject: [PATCH] fix fixity batch finished condition --- src/FixityCheckBatchCheck.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/FixityCheckBatchCheck.php b/src/FixityCheckBatchCheck.php index eb7f373..8e45671 100644 --- a/src/FixityCheckBatchCheck.php +++ b/src/FixityCheckBatchCheck.php @@ -170,7 +170,7 @@ class FixityCheckBatchCheck { $results = &$context['results']; if (!isset($sandbox['offset'])) { $sandbox['offset'] = 0; - $sandbox['remaining'] = $storage->countPeriodic(); + $sandbox['count'] = $storage->countPeriodic(); $results['successful'] = 0; $results['ignored'] = 0; $results['skipped'] = 0; @@ -179,7 +179,8 @@ class FixityCheckBatchCheck { } $files = $storage->getPeriodic($sandbox['offset'], $batch_size); - $end = min($sandbox['remaining'], $sandbox['offset'] + count($files)); + + $end = min($sandbox['count'], $sandbox['offset'] + count($files)); $context['message'] = \t('Processing @start to @end', [ '@start' => $sandbox['offset'], '@end' => $end, @@ -187,12 +188,7 @@ class FixityCheckBatchCheck { static::check($files, $force, $results); $sandbox['offset'] = $end; - $remaining = $storage->countPeriodic(); - $progress_halted = $sandbox['remaining'] == $remaining; - $sandbox['remaining'] = $remaining; - - // End when we have exhausted all inputs or progress has halted. - $context['finished'] = empty($files) || $progress_halted; + $context['finished'] = ($sandbox['count'] <= $end); } /**