diff --git a/includes/Hooks/HookUtils.php b/includes/Hooks/HookUtils.php index 1ada63145..3a0615c5c 100644 --- a/includes/Hooks/HookUtils.php +++ b/includes/Hooks/HookUtils.php @@ -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. diff --git a/maintenance/persistRevisionThreadItems.php b/maintenance/persistRevisionThreadItems.php index d9b718d14..a59a63da1 100644 --- a/maintenance/persistRevisionThreadItems.php +++ b/maintenance/persistRevisionThreadItems.php @@ -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' ];