persistRevisionThreadItems: Avoid listing non-discussion pages

Bug: T329627
Change-Id: I52a9f5dfa583d8dc2e0a315844a2a40e538f6a8c
This commit is contained in:
Bartosz Dziewoński 2023-02-14 14:43:39 +01:00
parent 7cea0c2b04
commit 445b8caca0
2 changed files with 17 additions and 0 deletions

View file

@ -327,6 +327,8 @@ class HookUtils {
/**
* Check if the tools are available for a given title
*
* Keep in sync with SQL conditions in persistRevisionThreadItems.php.
*
* @param Title $title
* @param string|null $feature Feature to check for (one of static::FEATURES)
* Null will check for any DT feature.

View file

@ -75,6 +75,21 @@ class PersistRevisionThreadItems extends Maintenance {
return;
}
// Add conditions from HookUtils::isAvailableForTitle().
// Keep this in sync with that method.
$nsInfo = $services->getNamespaceInfo();
$qb->leftJoin( 'page_props', null, [
'pp_propname' => 'newsectionlink',
'pp_page = page_id',
] );
$qb->where( $this->dbr->makeList( [
'page_namespace' => array_values( array_filter(
$nsInfo->getValidNamespaces(),
[ $nsInfo, 'wantSignatures' ]
) ),
'pp_propname IS NOT NULL',
], IDatabase::LIST_OR ) );
if ( $this->getOption( 'current' ) ) {
$qb->where( 'rev_id = page_latest' );
$index = [ 'page_id' ];