Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 26 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
SpecialWantedTemplates | |
0.00% |
0 / 25 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getQueryInfo | |
0.00% |
0 / 20 |
|
0.00% |
0 / 1 |
2 | |||
getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Copyright © 2008, Danny B. |
4 | * Based on SpecialWantedcategories.php by Ævar Arnfjörð Bjarmason <avarab@gmail.com> |
5 | * makeWlhLink() taken from SpecialMostlinkedtemplates by Rob Church <robchur@gmail.com> |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License along |
18 | * with this program; if not, write to the Free Software Foundation, Inc., |
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | * http://www.gnu.org/copyleft/gpl.html |
21 | * |
22 | * @file |
23 | */ |
24 | |
25 | namespace MediaWiki\Specials; |
26 | |
27 | use MediaWiki\Cache\LinkBatchFactory; |
28 | use MediaWiki\Linker\LinksMigration; |
29 | use MediaWiki\SpecialPage\WantedQueryPage; |
30 | use Wikimedia\Rdbms\IConnectionProvider; |
31 | |
32 | /** |
33 | * List of the most wanted templates |
34 | * |
35 | * @ingroup SpecialPage |
36 | * @author Danny B. |
37 | */ |
38 | class SpecialWantedTemplates extends WantedQueryPage { |
39 | |
40 | private LinksMigration $linksMigration; |
41 | |
42 | /** |
43 | * @param IConnectionProvider $dbProvider |
44 | * @param LinkBatchFactory $linkBatchFactory |
45 | * @param LinksMigration $linksMigration |
46 | */ |
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 | |
86 | /** |
87 | * Retain the old class name for backwards compatibility. |
88 | * @deprecated since 1.41 |
89 | */ |
90 | class_alias( SpecialWantedTemplates::class, 'SpecialWantedTemplates' ); |