Remove unused parameter
[mediawiki.git] / maintenance / checkBadRedirects.php
blob48a4b0e6d149c886660a18437f157e65f4ad7eb0
1 <?php
3 require "commandLine.inc";
5 echo "Fetching redirects...\n";
6 $dbr = wfGetDB( DB_SLAVE );
7 $result = $dbr->select(
8 array( 'page' ),
9 array( 'page_namespace','page_title', 'page_latest' ),
10 array( 'page_is_redirect' => 1 ) );
12 $count = $result->numRows();
13 echo "Found $count total redirects.\n";
14 echo "Looking for bad redirects:\n";
15 echo "\n";
17 foreach( $result as $row ) {
18 $title = Title::makeTitle( $row->page_namespace, $row->page_title );
19 $rev = Revision::newFromId( $row->page_latest );
20 if( $rev ) {
21 $target = Title::newFromRedirect( $rev->getText() );
22 if( !$target ) {
23 echo $title->getPrefixedText();
24 echo "\n";
29 echo "\n";
30 echo "done.\n";