Browse Source

Merge pull request #19 from seth-shaw-asu/issue-16

[DGI9-522] Allow FixityCheckBatchCheck to advance to the next batch
pull/22/head v1.2.2
Chris MacDonald 9 months ago committed by GitHub
parent
commit
0cf7aa9337
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      src/FixityCheckBatchCheck.php

12
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);
}
/**

Loading…
Cancel
Save