mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Linter
synced 2024-11-11 16:59:40 +00:00
Merge "Omit lints in hidden categories from search results"
This commit is contained in:
commit
b643225eb6
|
@ -42,7 +42,8 @@ class LintErrorsPager extends TablePager {
|
|||
private PermissionManager $permissionManager;
|
||||
|
||||
private ?string $category;
|
||||
private ?int $categoryId;
|
||||
/** @var mixed */
|
||||
private $categoryId;
|
||||
private array $namespaces;
|
||||
private bool $exactMatch;
|
||||
private string $title;
|
||||
|
@ -88,8 +89,11 @@ class LintErrorsPager extends TablePager {
|
|||
if ( $category !== null ) {
|
||||
$this->categoryId = $categoryManager->getCategoryId( $category );
|
||||
} else {
|
||||
$this->categoryId = null;
|
||||
$this->categoryId = array_values( $this->categoryManager->getCategoryIds(
|
||||
$this->categoryManager->getVisibleCategories()
|
||||
) );
|
||||
}
|
||||
|
||||
$this->namespaces = $namespaces;
|
||||
$this->exactMatch = $exactMatch;
|
||||
$this->title = $title;
|
||||
|
@ -109,11 +113,8 @@ class LintErrorsPager extends TablePager {
|
|||
'linter_id', 'linter_params',
|
||||
'linter_start', 'linter_end',
|
||||
'linter_cat'
|
||||
] );
|
||||
|
||||
if ( $this->categoryId !== null ) {
|
||||
$queryBuilder->where( [ 'linter_cat' => $this->categoryId ] );
|
||||
}
|
||||
] )
|
||||
->where( [ 'linter_cat' => $this->categoryId ] );
|
||||
|
||||
if ( $this->title !== '' ) {
|
||||
$namespaces = $this->namespaces ?: [ NS_MAIN ];
|
||||
|
@ -184,7 +185,8 @@ class LintErrorsPager extends TablePager {
|
|||
// category is set each time based on the category set in the lint error $row
|
||||
// not by the class when lints are being reported by type for many pages
|
||||
$category = $this->category;
|
||||
if ( $category === null && $row->linter_cat !== null ) {
|
||||
if ( $category === null ) {
|
||||
// Assert $row->linter_cat !== null ?
|
||||
$category = $this->categoryManager->getCategoryName( $row->linter_cat );
|
||||
} else {
|
||||
$row->linter_cat = $this->categoryId;
|
||||
|
|
|
@ -222,16 +222,16 @@ class SpecialLintErrors extends SpecialPage {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string|null $par
|
||||
* @param string|null $subPage
|
||||
*/
|
||||
public function execute( $par ) {
|
||||
public function execute( $subPage ) {
|
||||
$request = $this->getRequest();
|
||||
$out = $this->getOutput();
|
||||
|
||||
$params = $request->getQueryValues();
|
||||
|
||||
$this->setHeaders();
|
||||
$this->outputHeader( $par || isset( $params[ 'titlesearch' ] ) ? 'disable-summary' : '' );
|
||||
$this->outputHeader( $subPage || isset( $params[ 'titlesearch' ] ) ? 'disable-summary' : '' );
|
||||
|
||||
$namespaces = $this->findNamespaces( $request );
|
||||
|
||||
|
@ -248,7 +248,7 @@ class SpecialLintErrors extends SpecialPage {
|
|||
// of a custom namespace (just the text before a ':') to search for and pressed the associated Submit button.
|
||||
// Added the pageback parameter to inform the code that the '<- Special:LintErrors' link had been used to allow
|
||||
// the UI to redisplay with previous form values, instead of just resubmitting the query.
|
||||
if ( $par === null && isset( $params[ 'titlesearch' ] ) && !isset( $params[ 'pageback'] ) ) {
|
||||
if ( $subPage === null && isset( $params[ 'titlesearch' ] ) && !isset( $params[ 'pageback'] ) ) {
|
||||
unset( $params[ 'title' ] );
|
||||
$params = array_merge( [ 'pageback' => true ], $params );
|
||||
$out->addBacklinkSubtitle( $this->getPageTitle(), $params );
|
||||
|
@ -276,8 +276,11 @@ class SpecialLintErrors extends SpecialPage {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( in_array( $par, $this->getSubpagesForPrefixSearch() ) ) {
|
||||
$this->category = $par;
|
||||
if ( in_array( $subPage, array_merge(
|
||||
$this->categoryManager->getVisibleCategories(),
|
||||
$this->categoryManager->getInvisibleCategories()
|
||||
) ) ) {
|
||||
$this->category = $subPage;
|
||||
}
|
||||
|
||||
if ( !$this->category ) {
|
||||
|
|
Loading…
Reference in a new issue