MediaWiki REL1_33
manageForeignResources.php
Go to the documentation of this file.
1<?php
22require_once __DIR__ . '/Maintenance.php';
23
31 public function __construct() {
32 parent::__construct();
33 $this->addDescription( <<<TEXT
34Manage foreign resources registered with ResourceLoader.
35
36This helps developers with downloading, verifying, and updating local copies of upstream
37libraries registered as ResourceLoader modules. See resources/lib/foreign-resources.yaml.
38
39Use the "update" action to download urls specified in foreign-resources.yaml, and unpack
40them to the resources directory. This will also verify them against the integrity hashes.
41
42Use the "verify" action to verify the files currently in the resources directory match
43what "update" would replace them with. This is effectively a dry-run and will not change
44any module resources on disk.
45
46Use the "make-sri" action to compute an integrity hash for upstreams that do not publish
47one themselves. Add or update the urls foreign-resources.yaml as needed, but omit (or
48leave empty) the "integrity" key. Then, run the "make-sri" action for the module and
49copy the integrity into the file. Then, you can use "verify" or "update" normally.
50TEXT
51 );
52 $this->addArg( 'action', 'One of "update", "verify" or "make-sri"', true );
53 $this->addArg( 'module', 'Name of a single module (Default: all)', false );
54 $this->addOption( 'verbose', 'Be verbose', false, false, 'v' );
55 }
56
61 public function execute() {
62 global $IP;
63 $frm = new ForeignResourceManager(
64 "{$IP}/resources/lib/foreign-resources.yaml",
65 "{$IP}/resources/lib",
66 function ( $text ) {
67 $this->output( $text );
68 },
69 function ( $text ) {
70 $this->error( $text );
71 },
72 function ( $text ) {
73 if ( $this->hasOption( 'verbose' ) ) {
74 $this->output( $text );
75 }
76 }
77 );
78
79 $action = $this->getArg( 0 );
80 $module = $this->getArg( 1, 'all' );
81 return $frm->run( $action, $module );
82 }
83}
84
85$maintClass = ManageForeignResources::class;
86require_once RUN_MAINTENANCE_IF_MAIN;
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a and you may at your option offer warranty protection in exchange for a fee You may modify your copy or copies of the Program or any portion of thus forming a work based on the and copy and distribute such modifications or work under the terms of Section provided that you also meet all of these that in whole or in part contains or is derived from the Program or any part to be licensed as a whole at no charge to all third parties under the terms of this License c If the modified program normally reads commands interactively when you must cause when started running for such interactive use in the most ordinary to print or display an announcement including an appropriate copyright notice and a notice that there is no and telling the user how to view a copy of this and can be reasonably considered independent and separate works in themselves
Definition COPYING.txt:117
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition files
Definition COPYING.txt:158
and give any other recipients of the Program a copy of this License along with the Program You may charge a fee for the physical act of transferring a copy
Definition COPYING.txt:87
Manage foreign resources registered with ResourceLoader.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
addArg( $arg, $description, $required=true)
Add some args that are needed.
output( $out, $channel=null)
Throw some output to the user.
hasOption( $name)
Checks to see if a particular option exists.
getArg( $argId=0, $default=null)
Get an argument.
addDescription( $text)
Set the description text.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
Manage foreign resources registered with ResourceLoader.
__construct()
Default constructor.
Dynamic JavaScript and CSS resource loading system.
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place replace
Definition hooks.txt:2272
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults error
Definition hooks.txt:2644
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message key
Definition hooks.txt:2163
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to publish
$IP
Definition update.php:3
!hooks source !endhooks !test Non existent language !input< source lang="doesnotexist"> foobar</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > foobar</pre ></div > !end !test No language specified ! wikitext< source > foo</source > ! html< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > foo</pre ></div > !end !test No language specified(no wellformed xml) !! config !! wikitext< source > bar</source > !! html< div class
require_once RUN_MAINTENANCE_IF_MAIN
The most up to date schema for the tables in the database will always be tables sql in the maintenance directory
Definition schema.txt:2