MediaWiki  master
SpecialWantedTemplates.php
Go to the documentation of this file.
1 <?php
32 
39 
41  private $linksMigration;
42 
48  public function __construct(
49  ILoadBalancer $loadBalancer,
50  LinkBatchFactory $linkBatchFactory,
51  LinksMigration $linksMigration
52  ) {
53  parent::__construct( 'Wantedtemplates' );
54  $this->setDBLoadBalancer( $loadBalancer );
55  $this->setLinkBatchFactory( $linkBatchFactory );
56  $this->linksMigration = $linksMigration;
57  }
58 
59  public function getQueryInfo() {
60  $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' );
61  [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' );
62  return [
63  'tables' => array_merge( $queryInfo['tables'], [ 'page' ] ),
64  'fields' => [
65  'namespace' => $ns,
66  'title' => $title,
67  'value' => 'COUNT(*)'
68  ],
69  'conds' => [
70  'page_title IS NULL',
71  $ns => NS_TEMPLATE
72  ],
73  'options' => [ 'GROUP BY' => [ $ns, $title ] ],
74  'join_conds' => array_merge(
75  [ 'page' => [ 'LEFT JOIN',
76  [ "page_namespace = $ns", "page_title = $title" ] ] ],
77  $queryInfo['joins']
78  )
79  ];
80  }
81 
82  protected function getGroupName() {
83  return 'maintenance';
84  }
85 }
const NS_TEMPLATE
Definition: Defines.php:74
Service for compat reading of links tables.
setDBLoadBalancer(ILoadBalancer $loadBalancer)
Definition: QueryPage.php:916
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Definition: QueryPage.php:136
A querypage to list the most wanted templates.
__construct(ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory, LinksMigration $linksMigration)
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Class definition for a wanted query page like WantedPages, WantedTemplates, etc.
Create and track the database connections and transactions for a given database cluster.