From 14d73e212028f8921718daf14db4db10e835df2d Mon Sep 17 00:00:00 2001 From: Seth Shaw <108362375+seth-shaw-asu@users.noreply.github.com> Date: Wed, 20 Mar 2024 14:25:28 -0700 Subject: [PATCH 1/5] Fix relative datetime link --- src/Form/SettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 64cd4b6..996cb72 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -141,7 +141,7 @@ class SettingsForm extends ConfigFormBase { '#title' => $this->t('Time elapsed'), '#description' => $this->t('

Time threshold is relative to "now". For example "-1 month" would prevent any checks that occurred less than a month ago.

-

Check Relative Formats for acceptable values

+

Check Relative Formats for acceptable values

'), '#default_value' => $config->get(static::THRESHOLD) ?: '-1 month', '#element_validate' => [ From 2e66f63e9792077b51dcb46d319903cd9401aa10 Mon Sep 17 00:00:00 2001 From: Seth Shaw <108362375+seth-shaw-asu@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:16:15 -0700 Subject: [PATCH 2/5] update another relative datetime url --- src/Form/SettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 996cb72..d25ced1 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -209,7 +209,7 @@ class SettingsForm extends ConfigFormBase { '#title' => $this->t('Time elapsed'), '#description' => $this->t('

Time threshold is relative to "now". For example "-1 week" would mean a week must pass between notifications.

-

Check Relative Formats for acceptable values

+

Check Relative Formats for acceptable values

'), '#default_value' => $notification_threshold, '#element_validate' => [ From 13c435230c89d1ffc1bee0cbb20d2eaf0f0b8fb4 Mon Sep 17 00:00:00 2001 From: Seth Shaw Date: Thu, 11 Apr 2024 20:23:52 +0000 Subject: [PATCH 3/5] 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); } /** From a7e11b9ca15ce85265b3c3aa9661d29a8f7ffcd7 Mon Sep 17 00:00:00 2001 From: JojoVes Date: Tue, 16 Apr 2024 13:38:34 -0300 Subject: [PATCH 4/5] display configured batch size in form The batch size was getting set on form submission, but continuing to only display 100 in the form regardless of the configured value after changing it. --- src/Form/SettingsForm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 64cd4b6..069517a 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -155,7 +155,7 @@ class SettingsForm extends ConfigFormBase { '#description' => $this->t('

Set how many files will be processed at once when performing a batch / cron job

'), - '#default_value' => 100, + '#default_value' => $config->get(static::BATCH_SIZE) ?: 100, ], ]; From 11a6e667332de4d3977cf7541b29802b31f5d888 Mon Sep 17 00:00:00 2001 From: JojoVes Date: Tue, 16 Apr 2024 13:49:17 -0300 Subject: [PATCH 5/5] coder flagged alphabetized use statements --- src/Plugin/QueueWorker/FixityCheckWorker.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugin/QueueWorker/FixityCheckWorker.php b/src/Plugin/QueueWorker/FixityCheckWorker.php index 2bc09b5..65704e5 100644 --- a/src/Plugin/QueueWorker/FixityCheckWorker.php +++ b/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; /**