When a Scribunto external package is updated or added, MediaWiki needs to fetch it from GitLab.
As discussed at T412317, there is an opportunity to share code with Gadgets and anything else in the MediaWiki ecosystem that needs a package or plugin concept. So I'm proposing that the package fetcher be in a separate extension called Produnto.
There will be a GitLab webhook for tag events in the relevant repositories. This will post JSON to a MediaWiki REST API endpoint.
- Check and remove a configured repository URL prefix to extract the package name.
- Check for duplicate requests
- Insert a row into the package versions table, with state "fetching". Use a unique index to deduplicate requests.
- Queue a job
- Fetch a zip file from GitLab
- Iterate over files
- Hash the contents of the file
- Check if the hash is present in the file store. If not, insert it.
- Note that the file modification times in the zip are set to the commit time, so they are not useful for incremental updates.
- Insert a row into the file version table, linking the package version to the content hash
- Set the package version state to "ready"
This can all be in shared tables. The webhook will only post to a single wiki.