X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcheckBadRedirects.php;h=fec92910e4bd1783eda367ba669f21bf1a9f15ff;hb=937ae6444a683a3b0aaf14c21f529ad0e91419ef;hp=f0afe417a612b182a675f42034993826270b8537;hpb=659778619cc12d156d3547834c0f90f407584104;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/checkBadRedirects.php b/maintenance/checkBadRedirects.php index f0afe417a6..fec92910e4 100644 --- a/maintenance/checkBadRedirects.php +++ b/maintenance/checkBadRedirects.php @@ -1,7 +1,6 @@ mDescription = "Look for bad redirects"; + $this->mDescription = "Check for bad redirects"; } public function execute() { @@ -36,24 +41,24 @@ class CheckBadRedirects extends Maintenance { array( 'page' ), array( 'page_namespace', 'page_title', 'page_latest' ), array( 'page_is_redirect' => 1 ) ); - + $count = $result->numRows(); - $this->output( "Found $count total redirects.\n" . - "Looking for bad redirects:\n\n" ); - + $this->output( "Found $count redirects.\n" . + "Checking for bad redirects:\n\n" ); + foreach ( $result as $row ) { $title = Title::makeTitle( $row->page_namespace, $row->page_title ); $rev = Revision::newFromId( $row->page_latest ); if ( $rev ) { - $target = Title::newFromRedirect( $rev->getText() ); + $target = $rev->getContent()->getRedirectTarget(); if ( !$target ) { $this->output( $title->getPrefixedText() . "\n" ); } } } - $this->output( "\ndone.\n" ); + $this->output( "\nDone.\n" ); } } $maintClass = "CheckBadRedirects"; -require_once( DO_MAINTENANCE ); +require_once RUN_MAINTENANCE_IF_MAIN;