3 require "commandLine.inc";
5 echo "Fetching redirects...\n";
6 $dbr = wfGetDB( DB_SLAVE
);
7 $result = $dbr->select(
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";
17 foreach( $result as $row ) {
18 $title = Title
::makeTitle( $row->page_namespace
, $row->page_title
);
19 $rev = Revision
::newFromId( $row->page_latest
);
21 $target = Title
::newFromRedirect( $rev->getText() );
23 echo $title->getPrefixedText();