Page MenuHomePhabricator

Write an empty row to scan table on file upload
Closed, ResolvedPublic

Description

When a file is uploaded to the wiki a record of the image should be added to the scan table. This is done so that the image can be scanned while buffering requests to respect API limits.

Acceptance criteria
  • Write a row to the scan table when the UploadComplete PHP hook is fired.
  • Have this row have no last checked timestamp and store the identifier to the image

Related Objects

StatusSubtypeAssignedTask
OpenNone
DuplicateNone
Resolvedkostajh
ResolvedNone
ResolvedTchanders
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedBUG REPORTDreamy_Jazz
OpenNone
ResolvedBUG REPORTDreamy_Jazz
ResolvedDreamy_Jazz
Resolvedkostajh
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz

Event Timeline

Change 974187 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/MediaModeration@master] [WIP] Add images to mediamoderation_scan table on upload

https://gerrit.wikimedia.org/r/974187

Dreamy_Jazz renamed this task from Write an empty row to scan table on file upload to [M] Write an empty row to scan table on file upload.Nov 14 2023, 4:26 PM

Change 974187 merged by jenkins-bot:

[mediawiki/extensions/MediaModeration@master] Add images to mediamoderation_scan table on upload

https://gerrit.wikimedia.org/r/974187

Suggested QA steps:

  1. Install MediaModeration and run update.php
  2. Go to Special:Upload
  3. Upload a test file that is a png, gif or jpeg
  4. Using the following query, get the SHA-1 of the file (in base 36) from the database:
Find the SHA-1 for the uploaded image
SELECT img_sha1 FROM image WHERE img_name = <filename of the file without the "File:" prefix but with the file extension>;
  1. Inspect the mediamoderation_scan table and verify that a row has been added with the SHA-1 of the file:
Get the last row from mediamoderation_scan
SELECT * FROM mediamoderation_scan WHERE mms_sha1 = <value of img_sha1>;
What the row should look like
+---------------------------------+------------------+--------------+
| mms_sha1                        | mms_last_checked | mms_is_match |
+---------------------------------+------------------+--------------+
| <value of img_sha1>             |             NULL |         NULL |
+---------------------------------+------------------+--------------+
1 row in set (0.003 sec)
  1. Add $wgFileExtensions[] = 'mdi'; to your LocalSettings.php (not needed if using betawikis to test)
  2. Go back to Special:Upload and upload a midi file (example can be got from https://commons.wikimedia.org/wiki/File:2_Star_Spangled_Banner.mid). If the midi file came from commons, give it a different filename and ignore the duplicate file warning.
  3. Run the SQL query in step 4 to get the SHA-1 for the midi file.
  4. Run the SQL query in step 5 with the SHA-1 from step 8 and verify that no rows are returned.
Djackson-ctr subscribed.

I have verified that the new code has been implemented and is functioning and displaying as expected... Thank you for the QA Steps @Dreamy_Jazz

image.png (887×759 px, 68 KB)

image.png (342×754 px, 26 KB)

Dreamy_Jazz renamed this task from [M] Write an empty row to scan table on file upload to Write an empty row to scan table on file upload.Dec 1 2023, 10:34 AM
Dreamy_Jazz closed this task as Resolved.
Dreamy_Jazz updated the task description. (Show Details)
Dreamy_Jazz set Final Story Points to 2.