MediaWiki  REL1_24
SpecialUnusedtemplates.php
Go to the documentation of this file.
00001 <?php
00032 class UnusedtemplatesPage extends QueryPage {
00033     function __construct( $name = 'Unusedtemplates' ) {
00034         parent::__construct( $name );
00035     }
00036 
00037     function isExpensive() {
00038         return true;
00039     }
00040 
00041     function isSyndicated() {
00042         return false;
00043     }
00044 
00045     function sortDescending() {
00046         return false;
00047     }
00048 
00049     function getQueryInfo() {
00050         return array(
00051             'tables' => array( 'page', 'templatelinks' ),
00052             'fields' => array(
00053                 'namespace' => 'page_namespace',
00054                 'title' => 'page_title',
00055                 'value' => 'page_title'
00056             ),
00057             'conds' => array(
00058                 'page_namespace' => NS_TEMPLATE,
00059                 'tl_from IS NULL',
00060                 'page_is_redirect' => 0
00061             ),
00062             'join_conds' => array( 'templatelinks' => array(
00063                 'LEFT JOIN', array( 'tl_title = page_title',
00064                     'tl_namespace = page_namespace' ) ) )
00065         );
00066     }
00067 
00073     function formatResult( $skin, $result ) {
00074         $title = Title::makeTitle( NS_TEMPLATE, $result->title );
00075         $pageLink = Linker::linkKnown(
00076             $title,
00077             null,
00078             array(),
00079             array( 'redirect' => 'no' )
00080         );
00081         $wlhLink = Linker::linkKnown(
00082             SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() ),
00083             $this->msg( 'unusedtemplateswlh' )->escaped()
00084         );
00085 
00086         return $this->getLanguage()->specialList( $pageLink, $wlhLink );
00087     }
00088 
00089     function getPageHeader() {
00090         return $this->msg( 'unusedtemplatestext' )->parseAsBlock();
00091     }
00092 
00093     protected function getGroupName() {
00094         return 'maintenance';
00095     }
00096 }