9namespace MediaWiki\Specials;
11use MediaWiki\Deferred\LinksUpdate\CategoryLinksTable;
12use MediaWiki\Language\ILanguageConverter;
13use MediaWiki\Language\LanguageConverterFactory;
14use MediaWiki\Page\LinkBatchFactory;
15use MediaWiki\Skin\Skin;
16use MediaWiki\SpecialPage\WantedQueryPage;
17use MediaWiki\Title\Title;
19use Wikimedia\HtmlArmor\HtmlArmor;
20use Wikimedia\Rdbms\IConnectionProvider;
29 private $currentCategoryCounts;
38 parent::__construct(
'Wantedcategories' );
47 'tables' => [
'categorylinks',
'linktarget',
'page' ],
50 'title' =>
'lt_title',
53 'conds' => [
'page_title' => null ],
54 'options' => [
'GROUP BY' =>
'lt_title' ],
56 'linktarget' => [
'JOIN', [
'cl_target_id = lt_id' ] ],
57 'page' => [
'LEFT JOIN', [
'page_title = lt_title',
'page_namespace' =>
NS_CATEGORY ] ]
65 CategoryLinksTable::VIRTUAL_DOMAIN,
72 parent::preprocessResults( $db, $res );
74 $this->currentCategoryCounts = [];
76 if ( !$res->numRows() || !$this->isCached() ) {
84 foreach ( $res as $row ) {
85 $allCategories[] = $row->title;
90 $categoryRes = $localDb->newSelectQueryBuilder()
91 ->select( [
'cat_title',
'cat_pages' ] )
93 ->where( [
'cat_title' => $allCategories ] )
94 ->caller( __METHOD__ )->fetchResultSet();
95 foreach ( $categoryRes as $row ) {
96 $this->currentCategoryCounts[$row->cat_title] = intval( $row->cat_pages );
111 $text =
new HtmlArmor( $this->languageConverter->convertHtml( $nt->getText() ) );
119 $nlinks = $this->
msg(
'nmembers' )->numParams( $result->value )->escaped();
123 $currentValue = $this->currentCategoryCounts[$result->title] ?? 0;
124 $cachedValue = intval( $result->value );
127 if ( $nt->isKnown() || $currentValue === 0 ) {
128 $plink =
"<del>$plink</del>";
132 if ( $currentValue !== $cachedValue ) {
133 $nlinks = $this->
msg(
'nmemberschanged' )
134 ->numParams( $cachedValue, $currentValue )->escaped();
136 $nlinks = $this->
msg(
'nmembers' )->numParams( $cachedValue )->escaped();
140 return $this->
getLanguage()->specialList( $plink, $nlinks );
145 return 'maintenance';
154class_alias( SpecialWantedCategories::class,
'SpecialWantedCategories' );
makeTitle( $linkId)
Convert a link ID to a Title.to override Title
Factory for LinkBatch objects to batch query page metadata.
setDatabaseProvider(IConnectionProvider $databaseProvider)
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getContentLanguage()
Shortcut to get content language.
getLanguage()
Shortcut to get user's language.
Base class for a "wanted" query page like WantedPages, WantedTemplates, etc.