X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FLinksUpdate.php;h=141888cda6e2a241de1791caee6275826696a347;hb=62f7cdc33169d8abf590e8e2f70c8ddf43aeec14;hp=398df01b9ae8440dca4a74b1f7ac51ce733639cf;hpb=399d9c24a85b7e108ccfc51140af225c458f00b9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/LinksUpdate.php b/includes/deferred/LinksUpdate.php index 398df01b9a..141888cda6 100644 --- a/includes/deferred/LinksUpdate.php +++ b/includes/deferred/LinksUpdate.php @@ -141,14 +141,9 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { } foreach ( $this->mCategories as &$sortkey ) { - # If the sortkey is longer then 255 bytes, - # it truncated by DB, and then doesn't get - # matched when comparing existing vs current - # categories, causing T27254. - # Also. substr behaves weird when given "". - if ( $sortkey !== '' ) { - $sortkey = substr( $sortkey, 0, 255 ); - } + # If the sortkey is longer then 255 bytes, it is truncated by DB, and then doesn't match + # when comparing existing vs current categories, causing T27254. + $sortkey = mb_strcut( $sortkey, 0, 255 ); } $this->mRecursive = $recursive; @@ -161,7 +156,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { /** * Update link tables with outgoing links from an updated article * - * @note: this is managed by DeferredUpdates::execute(). Do not run this in a transaction. + * @note this is managed by DeferredUpdates::execute(). Do not run this in a transaction. */ public function doUpdate() { if ( $this->ticket ) { @@ -593,13 +588,7 @@ class LinksUpdate extends DataUpdate implements EnqueueableDataUpdate { $nt = Title::makeTitleSafe( NS_CATEGORY, $name ); $wgContLang->findVariantLink( $name, $nt, true ); - if ( $this->mTitle->getNamespace() == NS_CATEGORY ) { - $type = 'subcat'; - } elseif ( $this->mTitle->getNamespace() == NS_FILE ) { - $type = 'file'; - } else { - $type = 'page'; - } + $type = MWNamespace::getCategoryLinkType( $this->mTitle->getNamespace() ); # Treat custom sortkeys as a prefix, so that if multiple # things are forced to sort as '*' or something, they'll