UTF-8-ify comment
[lhc/web/wiklou.git] / includes / SpecialUnusedtemplates.php
1 <?php
2
3 /**
4 * @package MediaWiki
5 * @subpackage Special pages
6 *
7 * @author Rob Church <robchur@gmail.com>
8 * @copyright © 2006 Rob Church
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
10 */
11
12 /* */
13 require_once 'QueryPage.php';
14
15 /**
16 * @package MediaWiki
17 * @subpackage SpecialPage
18 */
19
20 class UnusedtemplatesPage extends QueryPage {
21
22 function getName() { return( 'Unusedtemplates' ); }
23 function isExpensive() { return( true ); }
24 function isSyndicated() { return( false ); }
25 function sortDescending() { return( false ); }
26
27 function getSQL() {
28 $dbr =& wfGetDB( DB_SLAVE );
29 extract( $dbr->tableNames( 'page', 'templatelinks' ) );
30 $sql = "SELECT 'Unusedtemplates' AS type, page_title AS title, page_namespace AS namespace, 0 AS value FROM $page LEFT JOIN $templatelinks ON page_namespace = tl_namespace AND page_title = tl_title WHERE page_namespace = 10 AND tl_from IS NULL";
31 return( $sql );
32 }
33
34 function formatResult( $skin, $result ) {
35 $title = Title::makeTitle( NS_TEMPLATE, $result->title );
36 $pageLink = $skin->makeKnownLinkObj( $title, '', 'redirect=no' );
37 $wlhLink = $skin->makeKnownLinkObj( Title::makeTitle( NS_SPECIAL, 'Whatlinkshere' ), wfMsgHtml( 'unusedtemplateswlh' ), 'target=' . $title->getPrefixedUrl() );
38 return( $pageLink . ' (' . $wlhLink . ')' );
39 }
40
41 function getPageHeader() {
42 return( wfMsgHtml( 'unusedtemplatestext' ) );
43 }
44
45 }
46
47 function wfSpecialUnusedtemplates() {
48 list( $limit, $offset ) = wfCheckLimits();
49 $utp = new UnusedtemplatesPage();
50 $utp->doQuery( $offset, $limit );
51 }
52
53 ?>