MediaWiki 1.44.0
SpecialWantedTemplates.php
Go to the documentation of this file.
1<?php
25namespace MediaWiki\Specials;
26
31
39
40 private LinksMigration $linksMigration;
41
42 public function __construct(
43 IConnectionProvider $dbProvider,
44 LinkBatchFactory $linkBatchFactory,
45 LinksMigration $linksMigration
46 ) {
47 parent::__construct( 'Wantedtemplates' );
48 $this->setDatabaseProvider( $dbProvider );
49 $this->setLinkBatchFactory( $linkBatchFactory );
50 $this->linksMigration = $linksMigration;
51 }
52
53 public function getQueryInfo() {
54 $queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' );
55 [ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' );
56 return [
57 'tables' => array_merge( $queryInfo['tables'], [ 'page' ] ),
58 'fields' => [
59 'namespace' => $ns,
60 'title' => $title,
61 'value' => 'COUNT(*)'
62 ],
63 'conds' => [
64 'page_title' => null,
65 $ns => NS_TEMPLATE
66 ],
67 'options' => [ 'GROUP BY' => [ $ns, $title ] ],
68 'join_conds' => array_merge(
69 [ 'page' => [ 'LEFT JOIN',
70 [ "page_namespace = $ns", "page_title = $title" ] ] ],
71 $queryInfo['joins']
72 )
73 ];
74 }
75
76 protected function getGroupName() {
77 return 'maintenance';
78 }
79}
80
85class_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.