X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfixDoubleRedirects.php;h=956828470812edd62edf62f3669974869eac0633;hb=d0e16713bcf0a065d22caad2125cc25d4d9245ef;hp=41458d18587eb31bbffd2704a37c0c8f7f8b8d7a;hpb=a8304d4c73fd04c338ae23f3028fc475921cc0fa;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/fixDoubleRedirects.php b/maintenance/fixDoubleRedirects.php index 41458d1858..9568284708 100644 --- a/maintenance/fixDoubleRedirects.php +++ b/maintenance/fixDoubleRedirects.php @@ -44,13 +44,14 @@ class FixDoubleRedirects extends Maintenance { public function execute() { $async = $this->getOption( 'async', false ); $dryrun = $this->getOption( 'dry-run', false ); - $title = $this->getOption( 'title' ); - if ( isset( $title ) ) { - $title = Title::newFromText( $title ); + if ( $this->hasOption( 'title' ) ) { + $title = Title::newFromText( $this->getOption( 'title' ) ); if ( !$title || !$title->isRedirect() ) { $this->error( $title->getPrefixedText() . " is not a redirect!\n", true ); } + } else { + $title = null; } $dbr = wfGetDB( DB_SLAVE ); @@ -75,7 +76,7 @@ class FixDoubleRedirects extends Maintenance { 'pb.page_is_redirect' => 1, ); - if ( isset( $title ) ) { + if ( $title != null ) { $conds['pb.page_namespace'] = $title->getNamespace(); $conds['pb.page_title'] = $title->getDBkey(); } @@ -85,6 +86,7 @@ class FixDoubleRedirects extends Maintenance { if ( !$res->numRows() ) { $this->output( "No double redirects found.\n" ); + return; } @@ -94,7 +96,6 @@ class FixDoubleRedirects extends Maintenance { foreach ( $res as $row ) { $titleA = Title::makeTitle( $row->pa_namespace, $row->pa_title ); $titleB = Title::makeTitle( $row->pb_namespace, $row->pb_title ); - RequestContext::getMain()->setTitle( $titleA ); $processedTitles .= "* [[$titleA]]\n"; @@ -106,7 +107,8 @@ class FixDoubleRedirects extends Maintenance { if ( !$async ) { $success = ( $dryrun ? true : $job->run() ); if ( !$success ) { - $this->error( "Error fixing " . $titleA->getPrefixedText() . ": " . $job->getLastError() . "\n" ); + $this->error( "Error fixing " . $titleA->getPrefixedText() + . ": " . $job->getLastError() . "\n" ); } } else { $jobs[] = $job;