Browse Source

Merge pull request #2 from discoverygarden/DDST-188

DDST-188: Updating to branch with latest from main
pull/23/head
Prashant-bd 7 months ago committed by GitHub
parent
commit
e0e512f7ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      src/FixityCheckBatchCheck.php
  2. 6
      src/Form/SettingsForm.php
  3. 2
      src/Plugin/QueueWorker/FixityCheckWorker.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);
}
/**

6
src/Form/SettingsForm.php

@ -141,7 +141,7 @@ class SettingsForm extends ConfigFormBase {
'#title' => $this->t('Time elapsed'),
'#description' => $this->t('
<p>Time threshold is relative to "<em>now</em>". For example "<em>-1 month</em>" would prevent any checks that occurred less than a month ago.</p>
<p>Check <a href="https://www.php.net/manual/en/datetime.formats.relative.php">Relative Formats</a> for acceptable values</p>
<p>Check <a href="https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative">Relative Formats</a> for acceptable values</p>
'),
'#default_value' => $config->get(static::THRESHOLD) ?: '-1 month',
'#element_validate' => [
@ -155,7 +155,7 @@ class SettingsForm extends ConfigFormBase {
'#description' => $this->t('
<p>Set how many files will be processed at once when performing a batch / cron job</p>
'),
'#default_value' => 100,
'#default_value' => $config->get(static::BATCH_SIZE) ?: 100,
],
];
@ -209,7 +209,7 @@ class SettingsForm extends ConfigFormBase {
'#title' => $this->t('Time elapsed'),
'#description' => $this->t('
<p>Time threshold is relative to "<em>now</em>". For example "<em>-1 week</em>" would mean a week must pass between notifications.</p>
<p>Check <a href="https://www.php.net/manual/en/datetime.formats.relative.php">Relative Formats</a> for acceptable values</p>
<p>Check <a href="https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative">Relative Formats</a> for acceptable values</p>
'),
'#default_value' => $notification_threshold,
'#element_validate' => [

2
src/Plugin/QueueWorker/FixityCheckWorker.php

@ -4,8 +4,8 @@ namespace Drupal\dgi_fixity\Plugin\QueueWorker;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\dgi_fixity\FixityCheckServiceInterface;
use Drupal\dgi_fixity\FixityCheckInterface;
use Drupal\dgi_fixity\FixityCheckServiceInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**

Loading…
Cancel
Save