From 754503259cf7ac6e3fa87355a55adddbb0df7ee2 Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Thu, 14 Sep 2023 10:19:31 -0300 Subject: [PATCH] D10 support. --- README.md | 8 ++++---- dgi_fixity.info.yml | 2 +- src/Controller/FixityCheckController.php | 1 + src/FixityCheckService.php | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f56a088..99e1c7d 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ Perform periodic fixity checks on selected files. This module defines a new content entity type `fixity_check`. This entity is used as an audit trail for fixity checks performed on a related `file` entity. -Wherein the revisions of the `fixity_check` record the results of previous +Wherein the revisions of the `fixity_check` record the results of previous checks against that `file` entity. -This modules requires and enforces the following constraints on `fixity_check` +This modules requires and enforces the following constraints on `fixity_check` entities: - **Must** be related to a `file` @@ -29,7 +29,7 @@ Users with the permission `View Fixity Checks` can: - View fixity audit log of Media entities A `cron` hook is setup to automatically mark files as _requiring_ periodic -checks. As well as performing those checks on a regular basis. Email +checks. As well as performing those checks on a regular basis. Email notifications can be configured to alert the selected user of the status of all performed checks on a regular basis or only when an error occurs. @@ -111,5 +111,5 @@ and or contact [discoverygarden]. [discoverygarden]: http://support.discoverygarden.ca [filehash]: https://www.drupal.org/project/filehash [gplv2]: http://www.gnu.org/licenses/gpl-2.0.txt -[install]: https://drupal.org/documentation/install/modules-themes/modules-8 +[install]: https://www.drupal.org/docs/extending-drupal/installing-modules [CTDA: Connecticut Digital Archive]: https://lib.uconn.edu/find/connecticut-digital-archive/ diff --git a/dgi_fixity.info.yml b/dgi_fixity.info.yml index 35817b5..c880577 100644 --- a/dgi_fixity.info.yml +++ b/dgi_fixity.info.yml @@ -2,7 +2,7 @@ name: 'Fixity' description: "Performs fixity checks on files." type: module package: DGI -core_version_requirement: ^8 || ^9 +core_version_requirement: ^9 || ^10 configure: dgi_fixity.settings dependencies: - drupal:file diff --git a/src/Controller/FixityCheckController.php b/src/Controller/FixityCheckController.php index 768d753..d21e3e8 100644 --- a/src/Controller/FixityCheckController.php +++ b/src/Controller/FixityCheckController.php @@ -235,6 +235,7 @@ class FixityCheckController extends ControllerBase { ->condition('id', $fixity_check->id()) ->sort('performed', 'DESC') ->pager(50) + ->accessCheck() ->execute(); return array_keys($result); } diff --git a/src/FixityCheckService.php b/src/FixityCheckService.php index 104598d..ecdcee1 100644 --- a/src/FixityCheckService.php +++ b/src/FixityCheckService.php @@ -293,6 +293,7 @@ class FixityCheckService implements FixityCheckServiceInterface { ->condition('performed', 0, '!=') ->groupBy('state') ->aggregate('id', 'COUNT') + ->accessCheck(FALSE) ->execute(); $failed = 0; @@ -312,12 +313,14 @@ class FixityCheckService implements FixityCheckServiceInterface { $periodic = (int) $storage->getQuery('AND') ->count('id') ->condition('periodic', TRUE) + ->accessCheck(FALSE) ->execute(); // All checks performed ever. $revisions = (int) $storage->getQuery('AND') ->allRevisions() ->count('id') + ->accessCheck(FALSE) ->execute(); // Checks which have exceeded the threshold and should be performed again. @@ -326,6 +329,7 @@ class FixityCheckService implements FixityCheckServiceInterface { ->condition('periodic', TRUE) ->condition('performed', $threshold, '>=') ->count('id') + ->accessCheck(FALSE) ->execute(); // Up to date checks.