From f96f22fa975586bc99fb6130dd9427993a2b7d1f Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Mon, 9 May 2022 04:50:24 -0300 Subject: [PATCH 1/3] [CTDA9-67] Check update operation in access controller. --- src/FixityCheckAccessControlHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FixityCheckAccessControlHandler.php b/src/FixityCheckAccessControlHandler.php index 0fbf552..af721a1 100644 --- a/src/FixityCheckAccessControlHandler.php +++ b/src/FixityCheckAccessControlHandler.php @@ -24,6 +24,7 @@ class FixityCheckAccessControlHandler extends EntityAccessControlHandler { case 'view revision': return AccessResult::allowedIfHasPermission($account, 'view fixity checks')->cachePerPermissions(); + case 'update': case 'delete': return AccessResult::allowedIfHasPermission($account, $admin_permission)->cachePerPermissions(); From 343b72e3f8b427e270bce1154a7949cdc6c03818 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Wed, 25 May 2022 07:51:01 -0300 Subject: [PATCH 2/3] Count failed checks and report when doing drush batch fixity check. --- src/FixityCheckBatchCheck.php | 3 +++ src/FixityCheckServiceInterface.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/FixityCheckBatchCheck.php b/src/FixityCheckBatchCheck.php index e0aa93c..2c1d089 100644 --- a/src/FixityCheckBatchCheck.php +++ b/src/FixityCheckBatchCheck.php @@ -219,6 +219,9 @@ class FixityCheckBatchCheck { if ($result->passed()) { $results['successful']++; } + else { + $results['failed']++; + } } else { // The check was not performed as the time elapsed since the last diff --git a/src/FixityCheckServiceInterface.php b/src/FixityCheckServiceInterface.php index c719418..347da6a 100644 --- a/src/FixityCheckServiceInterface.php +++ b/src/FixityCheckServiceInterface.php @@ -100,7 +100,7 @@ interface FixityCheckServiceInterface { * elapsed since the last check has not exceed the required threshold. * * @return \Drupal\dgi_fixity\Entity\FixityCheckInterface|null - * The resulting fixity_check if successful. + * The resulting fixity_check if performed. * NULL if the check was not performed because the time elapsed since the * last check has not exceed the required threshold. */ From 09b142c409fa29dc9ddffcb317efe01a3eddc248 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Wed, 25 May 2022 19:34:47 +0100 Subject: [PATCH 3/3] Derp --- src/FixityCheckBatchCheck.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FixityCheckBatchCheck.php b/src/FixityCheckBatchCheck.php index 2c1d089..eb7f373 100644 --- a/src/FixityCheckBatchCheck.php +++ b/src/FixityCheckBatchCheck.php @@ -179,7 +179,7 @@ class FixityCheckBatchCheck { } $files = $storage->getPeriodic($sandbox['offset'], $batch_size); - $end = min($sandbox['total'], $sandbox['offset'] + count($files)); + $end = min($sandbox['remaining'], $sandbox['offset'] + count($files)); $context['message'] = \t('Processing @start to @end', [ '@start' => $sandbox['offset'], '@end' => $end,