Change Title::getInterwiki() in conditions to Title::isExternal()
authorumherirrender <umherirrender_de.wp@web.de>
Thu, 2 Jan 2014 10:59:10 +0000 (11:59 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Thu, 2 Jan 2014 10:59:10 +0000 (11:59 +0100)
Change-Id: Icce26e6194ae96f262029554e05b49117d5e112e

includes/Export.php
includes/Import.php
includes/Linker.php
includes/PrefixSearch.php
includes/Title.php
includes/Wiki.php
includes/api/ApiQueryBase.php
includes/job/jobs/DoubleRedirectJob.php
includes/parser/ParserOutput.php
includes/specials/SpecialExport.php
includes/specials/SpecialRecentchangeslinked.php

index b4a507d..639ba28 100644 (file)
@@ -866,7 +866,7 @@ class XmlDumpWriter {
         * @since 1.18
         */
        public static function canonicalTitle( Title $title ) {
-               if ( $title->getInterwiki() ) {
+               if ( $title->isExternal() ) {
                        return $title->getPrefixedText();
                }
 
index 8b7af02..721b94b 100644 (file)
@@ -1717,7 +1717,7 @@ class ImportStreamSource {
                        return Status::newFatal( 'import-noarticle' );
                }
                $link = Title::newFromText( "$interwiki:Special:Export/$page" );
-               if ( is_null( $link ) || $link->getInterwiki() == '' ) {
+               if ( is_null( $link ) || !$link->isExternal() ) {
                        return Status::newFatal( 'importbadinterwiki' );
                } else {
                        $params = array();
index 27f8ab4..c4e2608 100644 (file)
@@ -1446,7 +1446,7 @@ class Linker {
 
                        $target = Title::newFromText( $linkTarget );
                        if ( $target ) {
-                               if ( $target->getText() == '' && $target->getInterwiki() === ''
+                               if ( $target->getText() == '' && !$target->isExternal()
                                        && !self::$commentLocal && self::$commentContextTitle
                                ) {
                                        $newTarget = clone ( self::$commentContextTitle );
index 3c464c5..780cae5 100644 (file)
@@ -44,7 +44,7 @@ class PrefixSearch {
 
                // Find a Title which is not an interwiki and is in NS_MAIN
                $title = Title::newFromText( $search );
-               if ( $title && $title->getInterwiki() == '' ) {
+               if ( $title && !$title->isExternal() ) {
                        $ns = array( $title->getNamespace() );
                        if ( $ns[0] == NS_MAIN ) {
                                $ns = $namespaces; // no explicit prefix, use default namespaces
@@ -57,7 +57,7 @@ class PrefixSearch {
                $title = Title::newFromText( $search . 'Dummy' );
                if ( $title && $title->getText() == 'Dummy'
                        && $title->getNamespace() != NS_MAIN
-                       && $title->getInterwiki() == '' ) {
+                       && !$title->isExternal() ) {
                        return self::searchBackend(
                                array( $title->getNamespace() ), '', $limit );
                }
index 5ab9e94..0b4b99c 100644 (file)
@@ -685,7 +685,7 @@ class Title {
         * @return Bool TRUE if this is an in-project interwiki link or a wikilink, FALSE otherwise
         */
        public function isLocal() {
-               if ( $this->mInterwiki != '' ) {
+               if ( $this->isExternal() ) {
                        $iw = Interwiki::fetch( $this->mInterwiki );
                        if ( $iw ) {
                                return $iw->isLocal();
@@ -719,7 +719,7 @@ class Title {
         * @return Bool TRUE if this is transcludable
         */
        public function isTrans() {
-               if ( $this->mInterwiki == '' ) {
+               if ( !$this->isExternal() ) {
                        return false;
                }
 
@@ -732,7 +732,7 @@ class Title {
         * @return String the DB name
         */
        public function getTransWikiID() {
-               if ( $this->mInterwiki == '' ) {
+               if ( !$this->isExternal() ) {
                        return false;
                }
 
@@ -830,7 +830,7 @@ class Title {
        public function getNsText() {
                global $wgContLang;
 
-               if ( $this->mInterwiki != '' ) {
+               if ( $this->isExternal() ) {
                        // This probably shouldn't even happen. ohh man, oh yuck.
                        // But for interwiki transclusion it sometimes does.
                        // Shit. Shit shit shit.
@@ -1014,7 +1014,7 @@ class Title {
         * @return Bool TRUE or FALSE
         */
        public function isMovable() {
-               if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->getInterwiki() != '' ) {
+               if ( !MWNamespace::isMovable( $this->getNamespace() ) || $this->isExternal() ) {
                        // Interwiki title or immovable namespace. Hooks don't get to override here
                        return false;
                }
@@ -1236,7 +1236,7 @@ class Title {
         */
        private function prefix( $name ) {
                $p = '';
-               if ( $this->mInterwiki != '' ) {
+               if ( $this->isExternal() ) {
                        $p = $this->mInterwiki . ':';
                }
 
@@ -1735,7 +1735,7 @@ class Title {
         *  interwiki link
         */
        public function getEditURL() {
-               if ( $this->mInterwiki != '' ) {
+               if ( $this->isExternal() ) {
                        return '';
                }
                $s = $this->getLocalURL( 'action=edit' );
@@ -3250,7 +3250,7 @@ class Title {
                } while ( true );
 
                # We already know that some pages won't be in the database!
-               if ( $this->mInterwiki != '' || NS_SPECIAL == $this->mNamespace ) {
+               if ( $this->isExternal() || NS_SPECIAL == $this->mNamespace ) {
                        $this->mArticleID = 0;
                }
                $fragment = strstr( $dbkey, '#' );
@@ -3306,13 +3306,13 @@ class Title {
                # and [[Foo]] point to the same place.  Don't force it for interwikis, since the
                # other site might be case-sensitive.
                $this->mUserCaseDBKey = $dbkey;
-               if ( $this->mInterwiki == '' ) {
+               if ( !$this->isExternal() ) {
                        $dbkey = self::capitalize( $dbkey, $this->mNamespace );
                }
 
                # Can't make a link to a namespace alone... "empty" local links can only be
                # self-links with a fragment identifier.
-               if ( $dbkey == '' && $this->mInterwiki == '' && $this->mNamespace != NS_MAIN ) {
+               if ( $dbkey == '' && !$this->isExternal() && $this->mNamespace != NS_MAIN ) {
                        return false;
                }
 
@@ -3582,7 +3582,7 @@ class Title {
                if ( !$this->isMovable() ) {
                        $errors[] = array( 'immobile-source-namespace', $this->getNsText() );
                }
-               if ( $nt->getInterwiki() != '' ) {
+               if ( $nt->isExternal() ) {
                        $errors[] = array( 'immobile-target-namespace-iw' );
                }
                if ( !$nt->isMovable() ) {
@@ -4494,7 +4494,7 @@ class Title {
                        return $isKnown;
                }
 
-               if ( $this->mInterwiki != '' ) {
+               if ( $this->isExternal() ) {
                        return true;  // any interwiki link might be viewable, for all we know
                }
 
index 5ebf5a0..1bb9c40 100644 (file)
@@ -121,7 +121,7 @@ class MediaWiki {
                        $ret = Title::newMainPage();
                }
 
-               if ( $ret === null || ( $ret->getDBkey() == '' && $ret->getInterwiki() == '' ) ) {
+               if ( $ret === null || ( $ret->getDBkey() == '' && !$ret->isExternal() ) ) {
                        $ret = SpecialPage::getTitleFor( 'Badtitle' );
                }
 
@@ -197,7 +197,7 @@ class MediaWiki {
                wfRunHooks( 'BeforeInitialize', array( &$title, &$unused, &$output, &$user, $request, $this ) );
 
                // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
-               if ( is_null( $title ) || ( $title->getDBkey() == '' && $title->getInterwiki() == '' )
+               if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() )
                        || $title->isSpecial( 'Badtitle' )
                ) {
                        $this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
@@ -231,7 +231,7 @@ class MediaWiki {
                $pageView = false; // was an article or special page viewed?
 
                // Interwiki redirects
-               if ( $title->getInterwiki() != '' ) {
+               if ( $title->isExternal() ) {
                        $rdfrom = $request->getVal( 'rdfrom' );
                        if ( $rdfrom ) {
                                $url = $title->getFullURL( array( 'rdfrom' => $rdfrom ) );
index d9aacaa..32a03f1 100644 (file)
@@ -493,7 +493,7 @@ abstract class ApiQueryBase extends ApiBase {
                if ( !$t ) {
                        $this->dieUsageMsg( array( 'invalidtitle', $titlePart ) );
                }
-               if ( $defaultNamespace != $t->getNamespace() || $t->getInterwiki() !== '' ) {
+               if ( $defaultNamespace != $t->getNamespace() || $t->isExternal() ) {
                        // This can happen in two cases. First, if you call titlePartToKey with a title part
                        // that looks like a namespace, but with $defaultNamespace = NS_MAIN. It would be very
                        // difficult to handle such a case. Such cases cannot exist and are therefore treated
index 99d7527..94b56ef 100644 (file)
@@ -197,7 +197,7 @@ class DoubleRedirectJob extends Job {
                        }
                        $seenTitles[$titleText] = true;
 
-                       if ( $title->getInterwiki() ) {
+                       if ( $title->isExternal() ) {
                                // If the target is interwiki, we have to break early (bug 40352).
                                // Otherwise it will look up a row in the local page table
                                // with the namespace/page of the interwiki target which can cause
index 76d14cf..8cd978b 100644 (file)
@@ -279,10 +279,10 @@ class ParserOutput extends CacheTime {
         * @throws MWException if given invalid input
         */
        function addInterwikiLink( $title ) {
-               $prefix = $title->getInterwiki();
-               if ( $prefix == '' ) {
+               if ( !$title->isExternal() ) {
                        throw new MWException( 'Non-interwiki link passed, internal parser error.' );
                }
+               $prefix = $title->getInterwiki();
                if ( !isset( $this->mInterwikiLinks[$prefix] ) ) {
                        $this->mInterwikiLinks[$prefix] = array();
                }
index bbed9e6..6fb5e8c 100644 (file)
@@ -315,7 +315,7 @@ class SpecialExport extends SpecialPage {
                        foreach ( explode( "\n", $page ) as $pageName ) {
                                $pageName = trim( $pageName );
                                $title = Title::newFromText( $pageName );
-                               if ( $title && $title->getInterwiki() == '' && $title->getText() !== '' ) {
+                               if ( $title && !$title->isExternal() && $title->getText() !== '' ) {
                                        // Only record each page once!
                                        $pageSet[$title->getPrefixedText()] = true;
                                }
index 5dee226..9a9cd13 100644 (file)
@@ -65,7 +65,7 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges {
                }
                $outputPage = $this->getOutput();
                $title = Title::newFromURL( $target );
-               if ( !$title || $title->getInterwiki() != '' ) {
+               if ( !$title || $title->isExternal() ) {
                        $outputPage->addHtml( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' )->parse() . '</div>' );
                        return false;
                }