X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfixDoubleRedirects.php;h=19b977773e719e65927e8709e88eec5470ae21a2;hb=e37ba117566b6a4ffe186718784c0a061ef56a64;hp=e52c6c34bf65e3ed7971fbbb018357367b07254e;hpb=4878e9593c313e0ab6d4a81a3ecea36a0afdb291;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/fixDoubleRedirects.php b/maintenance/fixDoubleRedirects.php index e52c6c34bf..19b977773e 100644 --- a/maintenance/fixDoubleRedirects.php +++ b/maintenance/fixDoubleRedirects.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fixes double redirects. @@ -55,7 +55,12 @@ class FixDoubleRedirects extends Maintenance { $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', @@ -66,6 +71,7 @@ class FixDoubleRedirects extends Maintenance { '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, ); @@ -83,12 +89,18 @@ class FixDoubleRedirects extends Maintenance { } $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() ); @@ -112,12 +124,12 @@ class FixDoubleRedirects extends Maintenance { 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 ) { $this->output( "Queuing batch of " . count( $jobs ) . " double redirects.\n" ); - Job::batchInsert( $dryrun ? array() : $jobs ); + JobQueueGroup::singleton()->push( $dryrun ? array() : $jobs ); } }