A maintenance script needs to be created that allows scanning of images in the uploadstash table. This script should read rows from the uploadstash table, process them and then add them to the mediamoderation_scan table with a match result included. This should meet the following requirements:
- This script should add the SHA-1 to the mediamoderation_scan table on a successful scan with the associated match status
- This script should appropriately handle errors, including if the rate-limit is reached.
- This script should email to a specified email address if a file is determined to be a match (T351407)
Files in the uploadstash table are not yet "uploaded" to the wiki, so a row for the SHA-1 of the image may not exist in the mediamoderation_scan table. This table is purged by default after 6 hours (21600 seconds), however, on commonswiki and testcommonswiki this is 48 hours (relevant config).
Acceptance criteria
- Create a maintenance script that scans images in the uploadstash table and meets the above requirements.
- Properly test this script for reliability