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