X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLinker.php;h=977d71efb6073696a762a4850872cb80daccf930;hb=c9d885f3b4578176a889f72cd3b8dd182a255a4a;hp=4ba3a755a3f597cf94c980db59409fc7bd0865f6;hpb=7340ddc12e299943485f8c928124a0890533dd9c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Linker.php b/includes/Linker.php index 4ba3a755a3..977d71efb6 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -19,6 +19,7 @@ * * @file */ +use MediaWiki\Linker\LinkTarget; /** * Some internal bits split of from Skin.php. These functions are used @@ -270,24 +271,23 @@ class Linker { /** * Returns the Url used to link to a Title * - * @param Title $target + * @param LinkTarget $target * @param array $query Query parameters * @param array $options * @return string */ - private static function linkUrl( $target, $query, $options ) { + private static function linkUrl( LinkTarget $target, $query, $options ) { # We don't want to include fragments for broken links, because they # generally make no sense. if ( in_array( 'broken', $options, true ) && $target->hasFragment() ) { - $target = clone $target; - $target->setFragment( '' ); + $target = $target->createFragmentTarget( '' ); } # If it's a broken link, add the appropriate query pieces, unless # there's already an action specified, or unless 'edit' makes no sense # (i.e., for a nonexistent special page). if ( in_array( 'broken', $options, true ) && empty( $query['action'] ) - && !$target->isSpecialPage() ) { + && $target->getNamespace() !== NS_SPECIAL ) { $query['action'] = 'edit'; $query['redlink'] = '1'; } @@ -300,7 +300,8 @@ class Linker { $proto = PROTO_RELATIVE; } - $ret = $target->getLinkURL( $query, false, $proto ); + $title = Title::newFromLinkTarget( $target ); + $ret = $title->getLinkURL( $query, false, $proto ); return $ret; }