Go to the documentation of this file.
28 require_once __DIR__ .
'/Maintenance.php';
37 parent::__construct();
38 $this->mDescription =
"Script to fix double redirects";
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' );
45 $async = $this->
getOption(
'async',
false );
46 $dryrun = $this->
getOption(
'dry-run',
false );
52 $this->
error(
$title->getPrefixedText() .
" is not a redirect!\n",
true );
65 'pa.page_namespace AS pa_namespace',
66 'pa.page_title AS pa_title',
67 'pb.page_namespace AS pb_namespace',
68 'pb.page_title AS pb_title',
71 'rd_from = pa.page_id',
72 'rd_namespace = pb.page_namespace',
73 'rd_title = pb.page_title',
74 'rd_interwiki IS NULL OR rd_interwiki = ' .
$dbr->addQuotes(
'' ),
75 'pb.page_is_redirect' => 1,
79 $conds[
'pb.page_namespace'] =
$title->getNamespace();
80 $conds[
'pb.page_title'] =
$title->getDBkey();
86 if ( !
$res->numRows() ) {
87 $this->
output(
"No double redirects found.\n" );
92 $processedTitles =
"\n";
99 $processedTitles .=
"* [[$titleA]]\n";
102 'reason' =>
'maintenance',
103 'redirTitle' => $titleB->getPrefixedDBkey()
109 $this->
error(
"Error fixing " . $titleA->getPrefixedText() .
": " .
$job->getLastError() .
"\n" );
114 if ( count( $jobs ) > 10000 ) {
120 if ( ++
$n % 100 == 0 ) {
121 $this->
output(
"$n...\n" );
125 if ( count( $jobs ) ) {
128 $this->
output(
"$n double redirects processed" . $processedTitles .
"\n" );
131 protected function queueJobs( $jobs, $dryrun =
false ) {
132 $this->
output(
"Queuing batch of " . count( $jobs ) .
" double redirects.\n" );
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
namespace and then decline to actually register it RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
addOption( $name, $description, $required=false, $withArg=false, $shortName=false)
Add a parameter to the script.
require_once RUN_MAINTENANCE_IF_MAIN
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
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
Job to fix double redirects after moving a page.
execute()
Do the actual work.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
presenting them properly to the user as errors is done by the caller $title
__construct()
Default constructor.
static getMain()
Static methods.
Maintenance script that fixes double redirects.
getOption( $name, $default=null)
Get an option, or return the default.
if(count( $args)< 1) $job
static singleton( $wiki=false)
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
error( $err, $die=0)
Throw an error to the user.
output( $out, $channel=null)
Throw some output to the user.
queueJobs( $jobs, $dryrun=false)