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'],
':' );
96 $pages[] = strtok(
'' );
100 if ( $page !==
null ) {
101 $this->
output(
"Fetched list up to {$page['title']}\n" );
104 if ( isset( $result[
'continue'] ) ) {
105 $data = array_replace( $data, $result[
'continue'] );
106 } elseif ( isset( $result[
'query-continue'][
'allpages'] ) ) {
107 $data = array_replace( $data, $result[
'query-continue'][
'allpages'] );
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, $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.
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.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
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
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
require_once RUN_MAINTENANCE_IF_MAIN