MediaWiki  REL1_19
SpecialUnusedtemplates.php
Go to the documentation of this file.
00001 <?php
00032 class UnusedtemplatesPage extends QueryPage {
00033 
00034         function __construct( $name = 'Unusedtemplates' ) {
00035                 parent::__construct( $name );
00036         }
00037 
00038         function isExpensive() { return true; }
00039         function isSyndicated() { return false; }
00040         function sortDescending() { return false; }
00041 
00042         function getQueryInfo() {
00043                 return array (
00044                         'tables' => array ( 'page', 'templatelinks' ),
00045                         'fields' => array ( 'page_namespace AS namespace',
00046                                         'page_title AS title',
00047                                         'page_title AS value' ),
00048                         'conds' => array ( 'page_namespace' => NS_TEMPLATE,
00049                                         'tl_from IS NULL',
00050                                         'page_is_redirect' => 0 ),
00051                         'join_conds' => array ( 'templatelinks' => array (
00052                                 'LEFT JOIN', array ( 'tl_title = page_title',
00053                                         'tl_namespace = page_namespace' ) ) )
00054                 );
00055         }
00056 
00062         function formatResult( $skin, $result ) {
00063                 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
00064                 $pageLink = Linker::linkKnown(
00065                         $title,
00066                         null,
00067                         array(),
00068                         array( 'redirect' => 'no' )
00069                 );
00070                 $wlhLink = Linker::linkKnown(
00071                         SpecialPage::getTitleFor( 'Whatlinkshere' ),
00072                         wfMsgHtml( 'unusedtemplateswlh' ),
00073                         array(),
00074                         array( 'target' => $title->getPrefixedText() )
00075                 );
00076                 return $this->getLanguage()->specialList( $pageLink, $wlhLink );
00077         }
00078 
00079         function getPageHeader() {
00080                 return wfMsgExt( 'unusedtemplatestext', array( 'parse' ) );
00081         }
00082 
00083 }
00084