Browse Source

fix fixity batch finished condition

pull/19/head
Seth Shaw 10 months ago
parent
commit
13c435230c
  1. 12
      src/FixityCheckBatchCheck.php

12
src/FixityCheckBatchCheck.php

@ -170,7 +170,7 @@ class FixityCheckBatchCheck {
$results = &$context['results']; $results = &$context['results'];
if (!isset($sandbox['offset'])) { if (!isset($sandbox['offset'])) {
$sandbox['offset'] = 0; $sandbox['offset'] = 0;
$sandbox['remaining'] = $storage->countPeriodic(); $sandbox['count'] = $storage->countPeriodic();
$results['successful'] = 0; $results['successful'] = 0;
$results['ignored'] = 0; $results['ignored'] = 0;
$results['skipped'] = 0; $results['skipped'] = 0;
@ -179,7 +179,8 @@ class FixityCheckBatchCheck {
} }
$files = $storage->getPeriodic($sandbox['offset'], $batch_size); $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', [ $context['message'] = \t('Processing @start to @end', [
'@start' => $sandbox['offset'], '@start' => $sandbox['offset'],
'@end' => $end, '@end' => $end,
@ -187,12 +188,7 @@ class FixityCheckBatchCheck {
static::check($files, $force, $results); static::check($files, $force, $results);
$sandbox['offset'] = $end; $sandbox['offset'] = $end;
$remaining = $storage->countPeriodic(); $context['finished'] = ($sandbox['count'] <= $end);
$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;
} }
/** /**

Loading…
Cancel
Save