Browse Source

Merge pull request #10 from discoverygarden/fix/d10-support

D10-28: D10 support.
pull/11/head v1.1.2
Noel Chiasson 1 year ago committed by GitHub
parent
commit
6513ea1184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      README.md
  2. 2
      dgi_fixity.info.yml
  3. 1
      src/Controller/FixityCheckController.php
  4. 4
      src/FixityCheckService.php

8
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 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. 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. 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: entities:
- **Must** be related to a `file` - **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 - View fixity audit log of Media entities
A `cron` hook is setup to automatically mark files as _requiring_ periodic 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 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. 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 [discoverygarden]: http://support.discoverygarden.ca
[filehash]: https://www.drupal.org/project/filehash [filehash]: https://www.drupal.org/project/filehash
[gplv2]: http://www.gnu.org/licenses/gpl-2.0.txt [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/ [CTDA: Connecticut Digital Archive]: https://lib.uconn.edu/find/connecticut-digital-archive/

2
dgi_fixity.info.yml

@ -2,7 +2,7 @@ name: 'Fixity'
description: "Performs fixity checks on files." description: "Performs fixity checks on files."
type: module type: module
package: DGI package: DGI
core_version_requirement: ^8 || ^9 core_version_requirement: ^9 || ^10
configure: dgi_fixity.settings configure: dgi_fixity.settings
dependencies: dependencies:
- drupal:file - drupal:file

1
src/Controller/FixityCheckController.php

@ -235,6 +235,7 @@ class FixityCheckController extends ControllerBase {
->condition('id', $fixity_check->id()) ->condition('id', $fixity_check->id())
->sort('performed', 'DESC') ->sort('performed', 'DESC')
->pager(50) ->pager(50)
->accessCheck()
->execute(); ->execute();
return array_keys($result); return array_keys($result);
} }

4
src/FixityCheckService.php

@ -293,6 +293,7 @@ class FixityCheckService implements FixityCheckServiceInterface {
->condition('performed', 0, '!=') ->condition('performed', 0, '!=')
->groupBy('state') ->groupBy('state')
->aggregate('id', 'COUNT') ->aggregate('id', 'COUNT')
->accessCheck(FALSE)
->execute(); ->execute();
$failed = 0; $failed = 0;
@ -312,12 +313,14 @@ class FixityCheckService implements FixityCheckServiceInterface {
$periodic = (int) $storage->getQuery('AND') $periodic = (int) $storage->getQuery('AND')
->count('id') ->count('id')
->condition('periodic', TRUE) ->condition('periodic', TRUE)
->accessCheck(FALSE)
->execute(); ->execute();
// All checks performed ever. // All checks performed ever.
$revisions = (int) $storage->getQuery('AND') $revisions = (int) $storage->getQuery('AND')
->allRevisions() ->allRevisions()
->count('id') ->count('id')
->accessCheck(FALSE)
->execute(); ->execute();
// Checks which have exceeded the threshold and should be performed again. // Checks which have exceeded the threshold and should be performed again.
@ -326,6 +329,7 @@ class FixityCheckService implements FixityCheckServiceInterface {
->condition('periodic', TRUE) ->condition('periodic', TRUE)
->condition('performed', $threshold, '>=') ->condition('performed', $threshold, '>=')
->count('id') ->count('id')
->accessCheck(FALSE)
->execute(); ->execute();
// Up to date checks. // Up to date checks.

Loading…
Cancel
Save