aboutsummaryrefslogtreecommitdiffstats
path: root/includes
diff options
context:
space:
mode:
authorC. Scott Ananian <cscott@cscott.net>2025-03-25 13:20:43 -0400
committerC. Scott Ananian <cscott@cscott.net>2025-04-04 13:41:55 -0400
commit87cacdf81302d46ec32e6cfc897b61e4e063e7c5 (patch)
tree000fd4395790bbb315da18da985da6312c021b39 /includes
parent8dc109fb755f2e7b6ffc313e55bc2927ee975c03 (diff)
downloadmediawikicore-87cacdf81302d46ec32e6cfc897b61e4e063e7c5.tar.gz
mediawikicore-87cacdf81302d46ec32e6cfc897b61e4e063e7c5.zip
CategoryLinksTable: use ParserOutput::getLinkList()
We converted most of the LinksUpdate tasks to use ::getLinkList() in I32df68714ffdf2f0745b974f47bc3ccceef1f41c but CategoryLinksTable got overlooked. Follows-Up: I32df68714ffdf2f0745b974f47bc3ccceef1f41c Change-Id: I2953947e2b0a3c05dcba89d798c6b977113c3dc0
Diffstat (limited to 'includes')
-rw-r--r--includes/deferred/LinksUpdate/CategoryLinksTable.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/includes/deferred/LinksUpdate/CategoryLinksTable.php b/includes/deferred/LinksUpdate/CategoryLinksTable.php
index 151566c9f408..bee5b26518ef 100644
--- a/includes/deferred/LinksUpdate/CategoryLinksTable.php
+++ b/includes/deferred/LinksUpdate/CategoryLinksTable.php
@@ -14,6 +14,7 @@ use MediaWiki\MainConfigNames;
use MediaWiki\Page\PageReferenceValue;
use MediaWiki\Page\WikiPageFactory;
use MediaWiki\Parser\ParserOutput;
+use MediaWiki\Parser\ParserOutputLinkTypes;
use MediaWiki\Parser\Sanitizer;
use MediaWiki\Storage\NameTableStore;
use MediaWiki\Title\NamespaceInfo;
@@ -142,8 +143,10 @@ class CategoryLinksTable extends TitleLinksTable {
$this->newLinks = [];
$sourceTitle = Title::castFromPageIdentity( $this->getSourcePage() );
$sortKeyInputs = [];
- foreach ( $parserOutput->getCategoryNames() as $name ) {
- $sortKey = $parserOutput->getCategorySortKey( $name );
+ foreach (
+ $parserOutput->getLinkList( ParserOutputLinkTypes::CATEGORY )
+ as [ 'link' => $targetTitle, 'sort' => $sortKey ]
+ ) {
'@phan-var string $sortKey'; // sort key will never be null
if ( $sortKey == '' ) {
@@ -160,7 +163,8 @@ class CategoryLinksTable extends TitleLinksTable {
// categories, causing T27254.
$sortKeyPrefix = mb_strcut( $sortKey, 0, 255 );
- $targetTitle = Title::makeTitle( NS_CATEGORY, $name );
+ $name = $targetTitle->getDBkey();
+ $targetTitle = Title::castFromLinkTarget( $targetTitle );
$this->languageConverter->findVariantLink( $name, $targetTitle, true );
// Ignore the returned text, DB key should be used for links (T328477).
$name = $targetTitle->getDBKey();