Title: Update conversion functions for LinkTarget interwiki support
authorKunal Mehta <legoktm@member.fsf.org>
Wed, 27 Apr 2016 21:26:34 +0000 (14:26 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Wed, 27 Apr 2016 21:30:39 +0000 (14:30 -0700)
Title::newFromLinkTarget() will now take the interwiki component from
the LinkTarget object, and Title::getTitleValue() will pass on the
interwiki part if there is one.

Follows-up 9b1f8b4ca331e45.

Change-Id: If1fecc9d71e58c476d6cebe6164cdc95f183048d

includes/Title.php

index 6f38283..7887890 100644 (file)
@@ -256,7 +256,9 @@ class Title implements LinkTarget {
                return self::makeTitle(
                        $linkTarget->getNamespace(),
                        $linkTarget->getText(),
-                       $linkTarget->getFragment() );
+                       $linkTarget->getFragment(),
+                       $linkTarget->getInterwiki()
+               );
        }
 
        /**
@@ -871,7 +873,9 @@ class Title implements LinkTarget {
                                $this->mTitleValue = new TitleValue(
                                        $this->getNamespace(),
                                        $this->getDBkey(),
-                                       $this->getFragment() );
+                                       $this->getFragment(),
+                                       $this->getInterwiki()
+                               );
                        } catch ( InvalidArgumentException $ex ) {
                                wfDebug( __METHOD__ . ': Can\'t create a TitleValue for [[' .
                                        $this->getPrefixedText() . ']]: ' . $ex->getMessage() . "\n" );