26 namespace MediaWiki\Specials;
44 private $currentCategoryCounts;
58 parent::__construct(
'Wantedcategories' );
66 'tables' => [
'categorylinks',
'page' ],
72 'conds' => [
'page_title' => null ],
73 'options' => [
'GROUP BY' =>
'cl_to' ],
74 'join_conds' => [
'page' => [
'LEFT JOIN',
75 [
'page_title = cl_to',
81 parent::preprocessResults( $db, $res );
83 $this->currentCategoryCounts = [];
85 if ( !$res->numRows() || !$this->isCached() ) {
93 foreach ( $res as $row ) {
94 $allCategories[] = $row->title;
97 $categoryRes = $db->newSelectQueryBuilder()
98 ->select( [
'cat_title',
'cat_pages' ] )
100 ->where( [
'cat_title' => $allCategories ] )
101 ->caller( __METHOD__ )->fetchResultSet();
102 foreach ( $categoryRes as $row ) {
103 $this->currentCategoryCounts[$row->cat_title] = intval( $row->cat_pages );
118 $text =
new HtmlArmor( $this->languageConverter->convertHtml( $nt->getText() ) );
126 $nlinks = $this->
msg(
'nmembers' )->numParams( $result->value )->escaped();
130 $currentValue = $this->currentCategoryCounts[$result->title] ?? 0;
131 $cachedValue = intval( $result->value );
134 if ( $nt->isKnown() || $currentValue === 0 ) {
135 $plink =
"<del>$plink</del>";
139 if ( $currentValue !== $cachedValue ) {
140 $nlinks = $this->
msg(
'nmemberschanged' )
141 ->numParams( $cachedValue, $currentValue )->escaped();
143 $nlinks = $this->
msg(
'nmembers' )->numParams( $cachedValue )->escaped();
147 return $this->
getLanguage()->specialList( $plink, $nlinks );
151 return 'maintenance';
159 class_alias( SpecialWantedCategories::class,
'SpecialWantedCategories' );
Marks HTML that shouldn't be escaped.
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.
Class definition for a wanted query page like WantedPages, WantedTemplates, etc.
The base class for all skins.
The shared interface for all language converters.