MediaWiki master
SpecialWantedTemplates.php
Go to the documentation of this file.
1<?php
29namespace MediaWiki\Specials;
30
35
42
43 private LinksMigration $linksMigration;
44
50 public function __construct(
51 IConnectionProvider $dbProvider,
52 LinkBatchFactory $linkBatchFactory,
53 LinksMigration $linksMigration
54 ) {
55 parent::__construct( 'Wantedtemplates' );
56 $this->setDatabaseProvider( $dbProvider );
57 $this->setLinkBatchFactory( $linkBatchFactory );
58 $this->linksMigration = $linksMigration;
59 }
60
61 public function getQueryInfo() {
62 $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' );
63 [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' );
64 return [
65 'tables' => array_merge( $queryInfo['tables'], [ 'page' ] ),
66 'fields' => [
67 'namespace' => $ns,
68 'title' => $title,
69 'value' => 'COUNT(*)'
70 ],
71 'conds' => [
72 'page_title' => null,
73 $ns => NS_TEMPLATE
74 ],
75 'options' => [ 'GROUP BY' => [ $ns, $title ] ],
76 'join_conds' => array_merge(
77 [ 'page' => [ 'LEFT JOIN',
78 [ "page_namespace = $ns", "page_title = $title" ] ] ],
79 $queryInfo['joins']
80 )
81 ];
82 }
83
84 protected function getGroupName() {
85 return 'maintenance';
86 }
87}
88
93class_alias( SpecialWantedTemplates::class, 'SpecialWantedTemplates' );
const NS_TEMPLATE
Definition Defines.php:74
Service for compat reading of links tables.
setDatabaseProvider(IConnectionProvider $databaseProvider)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Class definition for a wanted query page like WantedPages, WantedTemplates, etc.
A querypage to list the most wanted templates.
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...
__construct(IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory, LinksMigration $linksMigration)
Provide primary and replica IDatabase connections.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...