While at it, prettified code a bit and added list to output.
Change-Id: I989b5742ad46a9dd8c928a4ff5f76c869924730e
* (bug 39941) Add missing stylesheets to the installer pages
* In HTML5 mode, allow new input element types values (such as color, range..)
* (bug 40353) SpecialDoubleRedirect should support for interwiki redirects.
+* (bug 40352) fixDoubleRedirects.php should support for interwiki redirects.
=== API changes in 1.20 ===
* (bug 34316) Add ability to retrieve maximum upload size from MediaWiki API.
* (bug 11142) Improve file extension blacklist error reporting in API upload.
* (bug 39665) Cache AllowedGenerator array so it doesn't autoload all query classes
on every request.
-* (bug 35693) ApiQueryImageInfo now suppresses errors when unserializing metadata
+* (bug 35693) ApiQueryImageInfo now suppresses errors when unserializing metadata.
=== Languages updated in 1.20 ===
* @ingroup JobQueue
*/
class DoubleRedirectJob extends Job {
- var $reason, $redirTitle, $destTitleText;
+ var $reason, $redirTitle;
/**
* @var User
parent::__construct( 'fixDoubleRedirect', $title, $params, $id );
$this->reason = $params['reason'];
$this->redirTitle = Title::newFromText( $params['redirTitle'] );
- $this->destTitleText = !empty( $params['destTitle'] ) ? $params['destTitle'] : '';
}
/**
# Preserve fragment (bug 14904)
$newTitle = Title::makeTitle( $newTitle->getNamespace(), $newTitle->getDBkey(),
- $currentDest->getFragment() );
+ $currentDest->getFragment(), $newTitle->getInterwiki() );
# Fix the text
# Remember that redirect pages can have categories, templates, etc.,
}
$seenTitles[$titleText] = true;
+ if ( $title->getInterwiki() ) {
+ // If the target is interwiki, we have to break early (bug 40352).
+ // Otherwise it will look up a row in the local page table
+ // with the namespace/page of the interwiki target which can cause
+ // unexpected results (e.g. X -> foo:Bar -> Bar -> .. )
+ break;
+ }
+
$row = $dbw->selectRow(
array( 'redirect', 'page' ),
- array( 'rd_namespace', 'rd_title' ),
+ array( 'rd_namespace', 'rd_title', 'rd_interwiki' ),
array(
'rd_from=page_id',
'page_namespace' => $title->getNamespace(),
# No redirect from here, chain terminates
break;
} else {
- $dest = $title = Title::makeTitle( $row->rd_namespace, $row->rd_title );
+ $dest = $title = Title::makeTitle( $row->rd_namespace, $row->rd_title, '', $row->rd_interwiki );
}
}
return $dest;
$dbr = wfGetDB( DB_SLAVE );
- $tables = array( 'redirect', 'pa' => 'page', 'pb' => 'page' );
+ // See also SpecialDoubleRedirects
+ $tables = array(
+ 'redirect',
+ 'pa' => 'page',
+ 'pb' => 'page',
+ );
$fields = array(
'pa.page_namespace AS pa_namespace',
'pa.page_title AS pa_title',
'rd_from = pa.page_id',
'rd_namespace = pb.page_namespace',
'rd_title = pb.page_title',
+ '(rd_interwiki IS NULL OR rd_interwiki = "")', // bug 40352
'pb.page_is_redirect' => 1,
);
}
$jobs = array();
+ $processedTitles = "\n";
$n = 0;
foreach ( $res as $row ) {
$titleA = Title::makeTitle( $row->pa_namespace, $row->pa_title );
$titleB = Title::makeTitle( $row->pb_namespace, $row->pb_title );
- $job = new DoubleRedirectJob( $titleA, array( 'reason' => 'maintenance', 'redirTitle' => $titleB->getPrefixedDBkey() ) );
+ $processedTitles .= "* [[$titleA]]\n";
+
+ $job = new DoubleRedirectJob( $titleA, array(
+ 'reason' => 'maintenance',
+ 'redirTitle' => $titleB->getPrefixedDBkey()
+ ) );
if ( !$async ) {
$success = ( $dryrun ? true : $job->run() );
if ( count( $jobs ) ) {
$this->queueJobs( $jobs, $dryrun );
}
- $this->output( "$n double redirects processed.\n" );
+ $this->output( "$n double redirects processed" . $processedTitles . "\n" );
}
protected function queueJobs( $jobs, $dryrun = false ) {