38require_once __DIR__ .
'/Maintenance.php';
47 parent::__construct();
49 $this->
addOption(
'u',
"User to perform move",
false,
true );
50 $this->
addOption(
'r',
"Reason to move page",
false,
true );
51 $this->
addOption(
'i',
"Interval to sleep between moves" );
52 $this->
addOption(
'noredirects',
"Suppress creation of redirects" );
53 $this->
addArg(
'listfile',
'List of pages to move, newline delimited',
false );
59 # Change to current working directory
67 $noredirects = $this->
getOption(
'noredirects',
false );
69 $file = fopen( $this->
getArg(),
'r' );
76 $this->
error(
"Unable to read file, exiting",
true );
78 if (
$user ===
false ) {
79 $wgUser = User::newSystemUser(
'Move page script', [
'steal' =>
true ] );
84 $this->
error(
"Invalid username",
true );
87 # Setup complete, now start
90 for ( $linenum = 1; !feof( $file ); $linenum++ ) {
92 $line = fgets( $file );
93 if (
$line ===
false ) {
96 $parts = array_map(
'trim', explode(
'|',
$line ) );
97 if ( count( $parts ) != 2 ) {
98 $this->
error(
"Error on line $linenum, no pipe character" );
101 $source = Title::newFromText( $parts[0] );
102 $dest = Title::newFromText( $parts[1] );
103 if ( is_null(
$source ) || is_null( $dest ) ) {
104 $this->
error(
"Invalid title on line $linenum" );
108 $this->
output(
$source->getPrefixedText() .
' --> ' . $dest->getPrefixedText() );
113 $this->
output(
"\nFAILED: " .
$status->getWikiText(
false,
false,
'en' ) );
wfWaitForSlaves( $ifWritesSince=null, $wiki=false, $cluster=false, $timeout=null)
Waits for the replica DBs to catch up to the master position.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
error( $err, $die=0)
Throw an error to the user.
addArg( $arg, $description, $required=true)
Add some args that are needed.
beginTransaction(IDatabase $dbw, $fname)
Begin a transcation on a DB.
commitTransaction(IDatabase $dbw, $fname)
Commit the transcation on a DB handle and wait for replica DBs to catch up.
getStdin( $len=null)
Return input from stdin.
hasArg( $argId=0)
Does a given argument exist?
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
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.
Maintenance script to move a batch of pages.
execute()
Do the actual work.
__construct()
Default constructor.
Handles the backend logic of moving a page from one title to another.
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
when a variable name is used in a it is silently declared as a new local masking the global
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
require_once RUN_MAINTENANCE_IF_MAIN