Go to the documentation of this file.
28 require_once __DIR__ .
'/Maintenance.php';
37 parent::__construct();
39 $this->
addOption(
'async',
'Don\'t fix anything directly, just queue the jobs' );
40 $this->
addOption(
'title',
'Fix only redirects pointing to this page',
false,
true );
41 $this->
addOption(
'dry-run',
'Perform a dry run, fix nothing' );
66 'pa.page_namespace AS pa_namespace',
67 'pa.page_title AS pa_title',
68 'pb.page_namespace AS pb_namespace',
69 'pb.page_title AS pb_title',
72 'rd_from = pa.page_id',
73 'rd_namespace = pb.page_namespace',
74 'rd_title = pb.page_title',
75 'rd_interwiki IS NULL OR rd_interwiki = ' .
$dbr->addQuotes(
'' ),
76 'pb.page_is_redirect' => 1,
80 $conds[
'pb.page_namespace'] =
$title->getNamespace();
81 $conds[
'pb.page_title'] =
$title->getDBkey();
87 if ( !
$res->numRows() ) {
88 $this->
output(
"No double redirects found.\n" );
94 $processedTitles =
"\n";
100 $processedTitles .=
"* [[$titleA]]\n";
103 'reason' =>
'maintenance',
104 'redirTitle' => $titleB->getPrefixedDBkey()
110 $this->
error(
"Error fixing " . $titleA->getPrefixedText()
111 .
": " .
$job->getLastError() .
"\n" );
116 if (
count( $jobs ) > 10000 ) {
122 if ( ++$n % 100 == 0 ) {
123 $this->
output(
"$n...\n" );
127 if (
count( $jobs ) ) {
130 $this->
output(
"$n double redirects processed" . $processedTitles .
"\n" );
133 protected function queueJobs( $jobs, $dryrun =
false ) {
134 $this->
output(
"Queuing batch of " .
count( $jobs ) .
" double redirects.\n" );
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
fatalError( $msg, $exitCode=1)
Output a message and terminate the current script.
addDescription( $text)
Set the description text.
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
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
Job to fix double redirects after moving a page.
execute()
Do the actual work.
namespace and then decline to actually register it file or subcat img or subcat $title
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
__construct()
Default constructor.
Maintenance script that fixes double redirects.
static singleton( $domain=false)
getOption( $name, $default=null)
Get an option, or return the default.
if(count( $args)< 1) $job
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
getDB( $db, $groups=[], $wiki=false)
Returns a database to be used by current maintenance script.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
hasOption( $name)
Checks to see if a particular option exists.
queueJobs( $jobs, $dryrun=false)