scanner_fixer_api
A framework for scanning for issues and then fixing them.
In the Scanner-Fixer API module...
A Scanner is a way to find things to fix, as the first step in a Solution. Scanners aren't designed to be run on their own. A Scanner produces an array of item IDs (e.g.: node IDs, taxonomy IDs, UUIDs, etc.) that will be passed to Fixers to work on.
A Fixer is a way to act upon the things found by a Scanner, as the second step in a Solution. Fixers aren't designed to be run on their own either. A Fixer evaluates an item ID to see if it can fix it (i.e.: if it can act upon it). A Fixer can also try to perform a fix on an item ID.
A Solution is a way to group Scanners and Fixers. That is to say, a Solution allows the output from one or more Scanners to be combined together into a larger array of item IDs. The resulting array is passed to one or more Fixers to act upon those IDs.
Features
- An extensible plugin-based API for defining Solutions from Scanners and Fixers in code.
- If you're unfamiliar with Drupal 8's Plugin API, @eojthebrave wrote an introduction to Plugins on the Drupalize.me blog (but note that it describes Drupal 8's plugin system as it was in 2014 — there have been many improvements since then!)
- A list of Solutions at
/admin/content/scanner_fixer_api, controlled by the permission Use the Scanner-fixer solution-overview page. - A way to run Solutions through Drupal's administration UI, with a unique permission for each Solution.
- A way to run Solutions through Drush (Drupal's CLI).
Requirements
This module requires no modules outside of Drupal core.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
Configuration
The Scanner-Fixer API is a developer module, which is to say that all functionality in the module is defined by writing code, and the module has no configuration of its own.
See the Scanner-Fixer API example sub-module for an example, and documentation.
The module displays a list of Solutions at /admin/content/scanner_fixer_api in order to make it easier to run Solutions from Drupal's web UI. A user needs a role with the Use the Scanner-fixer solution-overview page permission (use scanner-fixer solution overview page) in order to see the list of Solutions.
The module generates a permission for each Solution; and a user must have that permission in order to run the Solution from the UI.
The Scanner-Fixer API module also defines Drush commands for listing and running solutions:
- To list solutions, run
drush scanner-fixer:list-solutions - To run a particular solution, run
drush scanner-fixer:run-solution solution_id
Roadmap
The 7.x-1.x release series is now unsupported.
The 2.0.x release series closely matches the API of the 7.x-1.x release series, in order to make it easier to port code from the 7.x-1.x release series. The maintainers will accept bug-fixes and backwards-compatible features to the 2.0.x release series.
The 3.0.x release series is for breaking changes.
Extending modules
If you maintain any contributed modules that enhance the functionality of Scanner-Fixer API (i.e.: by offering pre-built Scanners, Fixers, and/or Solutions), please add it to Scanner-Fixer API's ecosystem by referencing it in the Ecosystem field on your project's page.
Supporting this Module
The best way to support this module is to contribute to it! Contributions to add automated tests are always welcome; and including tests in your bug reports, feature requests, etc. is a great way to fast-track your contributions! Automated tests allow the Scanner-Fixer API maintainers to work faster, and they also help you, by detecting if a proposed change to Scanner-Fixer API would break your site (i.e.: by detecting regressions)!
The Drupal Association (DA) pays for the infrastructure that the Scanner-Fixer API module maintainers use. Consider donating to the DA to help keep Drupal.org, the Drupal composer repository, and automated tests running smoothly.
If you would like to hire a maintainer to add a feature to Scanner-Fixer API that you want, please reach out to the maintainer through their contact form or their organization.