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