]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/specials/SpecialWantedtemplates.php
MediaWiki 1.16.1-scripts
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialWantedtemplates.php
1 <?php
2 /**
3  * @file
4  * @ingroup SpecialPage
5  */
6
7 /**
8  * A querypage to list the most wanted templates - implements Special:Wantedtemplates
9  * based on SpecialWantedcategories.php by Ævar Arnfjörð Bjarmason <avarab@gmail.com>
10  * makeWlhLink() taken from SpecialMostlinkedtemplates by Rob Church <robchur@gmail.com>
11  *
12  * @ingroup SpecialPage
13  *
14  * @author Danny B.
15  * @copyright Copyright © 2008, Danny B.
16  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
17  */
18 class WantedTemplatesPage extends WantedQueryPage {
19
20         function getName() {
21                 return 'Wantedtemplates';
22         }
23
24         function getSQL() {
25                 $dbr = wfGetDB( DB_SLAVE );
26                 list( $templatelinks, $page ) = $dbr->tableNamesN( 'templatelinks', 'page' );
27                 $name = $dbr->addQuotes( $this->getName() );
28                 return
29                         "
30                           SELECT $name as type, 
31                                  tl_namespace as namespace,
32                                  tl_title as title,
33                                  COUNT(*) as value
34                             FROM $templatelinks LEFT JOIN
35                                  $page ON tl_title = page_title AND tl_namespace = page_namespace
36                            WHERE page_title IS NULL AND tl_namespace = ". NS_TEMPLATE ."
37                         GROUP BY tl_namespace, tl_title
38                         ";
39         }
40 }
41
42 /**
43  * constructor
44  */
45 function wfSpecialWantedTemplates() {
46         list( $limit, $offset ) = wfCheckLimits();
47
48         $wpp = new WantedTemplatesPage();
49
50         $wpp->doQuery( $offset, $limit );
51 }