MediaWiki master
SpecialWantedTemplates.php
Go to the documentation of this file.
1<?php
25namespace MediaWiki\Specials;
26
31
39
40 private LinksMigration $linksMigration;
41
47 public function __construct(
48 IConnectionProvider $dbProvider,
49 LinkBatchFactory $linkBatchFactory,
50 LinksMigration $linksMigration
51 ) {
52 parent::__construct( 'Wantedtemplates' );
53 $this->setDatabaseProvider( $dbProvider );
54 $this->setLinkBatchFactory( $linkBatchFactory );
55 $this->linksMigration = $linksMigration;
56 }
57
58 public function getQueryInfo() {
59 $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' );
60 [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' );
61 return [
62 'tables' => array_merge( $queryInfo['tables'], [ 'page' ] ),
63 'fields' => [
64 'namespace' => $ns,
65 'title' => $title,
66 'value' => 'COUNT(*)'
67 ],
68 'conds' => [
69 'page_title' => null,
70 $ns => NS_TEMPLATE
71 ],
72 'options' => [ 'GROUP BY' => [ $ns, $title ] ],
73 'join_conds' => array_merge(
74 [ 'page' => [ 'LEFT JOIN',
75 [ "page_namespace = $ns", "page_title = $title" ] ] ],
76 $queryInfo['joins']
77 )
78 ];
79 }
80
81 protected function getGroupName() {
82 return 'maintenance';
83 }
84}
85
90class_alias( SpecialWantedTemplates::class, 'SpecialWantedTemplates' );
const NS_TEMPLATE
Definition Defines.php:75
Service for compat reading of links tables.
setDatabaseProvider(IConnectionProvider $databaseProvider)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Base class for a "wanted" query page like WantedPages, WantedTemplates, etc.
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.