24require_once __DIR__ .
'/Maintenance.php';
34 parent::__construct();
36 $this->
addArg(
'api',
'API base url' );
37 $this->
addArg(
'index',
'index.php base url' );
38 $this->
addOption(
'username',
'User name of the script importer' );
52 $baseUrl = $this->
getArg( 1 );
54 $this->
output(
'Importing ' . count( $pageList ) .
" pages\n" );
56 foreach ( $pageList as $page ) {
57 $title = Title::makeTitleSafe( NS_MEDIAWIKI, $page );
59 $this->
error(
"$page is an invalid title; it will not be imported\n" );
63 $this->
output(
"Importing $page\n" );
66 'title' =>
"MediaWiki:{$page}" ] );
67 $text =
Http::get( $url, [], __METHOD__ );
69 $wikiPage = WikiPage::factory( $title );
70 $content = ContentHandler::makeContent( $text, $wikiPage->getTitle() );
71 $wikiPage->doEditContent(
$content,
"Importing from $url", 0,
false, $user );
84 $baseUrl = $this->
getArg( 0 );
89 $strResult =
Http::get( $url, [], __METHOD__ );
90 $result = FormatJson::decode( $strResult,
true );
93 foreach ( $result[
'query'][
'allpages'] as $page ) {
94 if (
substr( $page[
'title'], -3 ) ===
'.js' ) {
95 strtok( $page[
'title'],
':' );
100 if ( $page !==
null ) {
101 $this->
output(
"Fetched list up to {$page['title']}\n" );
104 if (
isset( $result[
'continue'] ) ) {
106 }
elseif (
isset( $result[
'query-continue'][
'allpages'] ) ) {
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfAppendQuery( $url, $query)
Append a query string to an existing URL, which may or may not already have query string parameters a...
static get( $url, array $options=[], $caller=__METHOD__)
Simple wrapper for Http::request( 'GET' )
Maintenance script to import all scripts in the MediaWiki namespace from a local site.
execute()
Do the actual work.
__construct()
Default constructor.
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.
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.
getOption( $name, $default=null)
Get an option, or return the default.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static newSystemUser( $name, $options=[])
Static factory method for creation of a "system" user from username.
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
this hook is for auditing only or null if authentication failed before getting that far $username
return true to allow those checks to and false if checking is done & $user
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
require_once RUN_MAINTENANCE_IF_MAIN