replace TYPE= with ENGINE=, (supported since 4.0, TYPE deprecated since 4.1)
[lhc/web/wiklou.git] / includes / SpecialListredirects.php
1 <?php
2 /**
3 * @package MediaWiki
4 * @subpackage 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 require_once 'QueryPage.php';
13
14 /**
15 * @package MediaWiki
16 * @subpackage SpecialPage
17 */
18
19 class ListredirectsPage extends QueryPage {
20
21 function getName() { return( 'listredirects' ); }
22 function isExpensive() { return( true ); }
23 function isSyndicated() { return( false ); }
24 function sortDescending() { return( false ); }
25
26 function getSQL() {
27 $dbr =& wfGetDB( DB_SLAVE );
28 return( 'SELECT page_title AS title, page_namespace AS namespace, page_namespace AS value FROM ' . $dbr->tableName( 'page' ) . ' WHERE page_is_redirect = 1' );
29 }
30
31 function formatResult( $skin, $result ) {
32 # Make a link to the redirect itself
33 $rd_title = Title::makeTitle( $result->namespace, $result->title );
34 $rd_link = $skin->makeKnownLinkObj( $rd_title, '', 'redirect=no' );
35
36 # Find out where the redirect leads
37 $revision = Revision::newFromTitle( $rd_title );
38 if( $revision ) {
39 # Make a link to the destination page
40 $target = Title::newFromRedirect( $revision->getText() );
41 if( $target ) {
42 $targetLink = $skin->makeLinkObj( $target );
43 } else {
44 /** @todo Put in some decent error display here */
45 $targetLink = '*';
46 }
47 } else {
48 /** @todo Put in some decent error display here */
49 $targetLink = '*';
50 }
51
52 # Format the whole thing and return it
53 return( $rd_link . ' &rarr; ' . $targetLink );
54
55 }
56
57 }
58
59 function wfSpecialListredirects() {
60 list( $limit, $offset ) = wfCheckLimits();
61 $lrp = new ListredirectsPage();
62 $lrp->doQuery( $offset, $limit );
63 }
64
65 ?>