| 1 |
<?php |
| 2 |
|
| 3 |
. |
| 4 |
om> |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 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 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
class SpecialWantedTemplates extends WantedQueryPage { |
| 39 |
|
| 40 |
private LinksMigration $linksMigration; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 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 |
|
| 88 |
|
| 89 |
|
| 90 |
class_alias( SpecialWantedTemplates::class, 'SpecialWantedTemplates' ); |