Mass convert NULL -> null. Left strings and comments alone, obviously.
[lhc/web/wiklou.git] / includes / specials / SpecialListredirects.php
1 <?php
2 /**
3 * @file
4 * @ingroup SpecialPage
5 *
6 * @author Rob Church <robchur@gmail.com>
7 * @copyright © 2006 Rob Church
8 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
9 */
10
11 /**
12 * Special:Listredirects - Lists all the redirects on the wiki.
13 * @ingroup SpecialPage
14 */
15 class ListredirectsPage extends QueryPage {
16
17 function getName() { return( 'Listredirects' ); }
18 function isExpensive() { return( true ); }
19 function isSyndicated() { return( false ); }
20 function sortDescending() { return( false ); }
21
22 function getSQL() {
23 $dbr = wfGetDB( DB_SLAVE );
24 $page = $dbr->tableName( 'page' );
25 $sql = "SELECT 'Listredirects' AS type, page_title AS title, page_namespace AS namespace,
26 0 AS value FROM $page WHERE page_is_redirect = 1";
27 return( $sql );
28 }
29
30 function formatResult( $skin, $result ) {
31 global $wgContLang;
32
33 # Make a link to the redirect itself
34 $rd_title = Title::makeTitle( $result->namespace, $result->title );
35 $rd_link = $skin->link(
36 $rd_title,
37 null,
38 array(),
39 array( 'redirect' => 'no' )
40 );
41
42 # Find out where the redirect leads
43 $revision = Revision::newFromTitle( $rd_title );
44 if( $revision ) {
45 # Make a link to the destination page
46 $target = Title::newFromRedirect( $revision->getText() );
47 if( $target ) {
48 $arr = $wgContLang->getArrow() . $wgContLang->getDirMark();
49 $targetLink = $skin->link( $target );
50 return "$rd_link $arr $targetLink";
51 } else {
52 return "<s>$rd_link</s>";
53 }
54 } else {
55 return "<s>$rd_link</s>";
56 }
57 }
58 }
59
60 function wfSpecialListredirects() {
61 list( $limit, $offset ) = wfCheckLimits();
62 $lrp = new ListredirectsPage();
63 $lrp->doQuery( $offset, $limit );
64 }