Manual:manageForeignResources.php

From Linux Web Expert

Revision as of 23:22, 9 March 2024 by imported>Shirayuki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Details

manageForeignResources.php is a maintenance script that manages foreign resources registered with ResourceLoader.

Options/Arguments

Option Description Required Default value
action One of "update", "verify" or "make-sri" <translate> Required</translate>
module Name of a single module <translate> Optional</translate> all
--extension Name of an extension <translate> (introduced in <tvar, Gerrit change 911307 <translate> Optional</translate>
--skin Name of an skin <translate> (introduced in <tvar, Gerrit change 911307 <translate> Optional</translate>
--verbose Be verbose <translate> Optional</translate>

Use the update action to download URLs specified in foreign-resources.yaml and unpack them to the resources directory. This will also verify them against the integrity hashes.

Use the verify action to verify that the files currently in the resources directory match what "update" would replace them with. This is effectively a dry run and will not change any module resources on disk.

Use the make-sri action to compute an integrity hash for upstreams that do not publish one themselves. Add or update the URLs in foreign-resources.yaml as needed, but omit (or leave empty) the "integrity" key. Then, run the "make-sri" action for the module, and copy the integrity into the file. Then, you can use "verify" or "update" normally.

--extension / --skin can be used to specify which extension or skin to update / verify foreign resources for; if neither is used, the script will operate on the foreign resources for MediaWiki core.

Usage

php maintenance/manageForeignResources.php actionName [ moduleName | --extension | --skin | --verbose ]

Updating foreign resources

Terminal

Verifying a module

Terminal

Common errors

Unknown module name

As of 25 Oct 2021, the module name must be one of:

CLDRPluralRuleParser, html5shiv, jquery, jquery.chosen, jquery.client,
jquery.cookie, jquery.form, jquery.fullscreen, jquery.hoverIntent, jquery.i18n,
jquery.jStorage, jquery.throttle-debounce, moment, mustache, oojs, oojs-router,
ooui, pako, promise-polyfill, qunitjs, sinonjs, vue, vuex.
Unknown component: <extension or skin name>

This probably means the given extension/skin did not set its ForeignResourceDirs attribute.

See also