Avoid using deprecated Title::canTalk()
authorKunal Mehta <legoktm@member.fsf.org>
Tue, 29 Aug 2017 19:36:33 +0000 (12:36 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Tue, 29 Aug 2017 19:36:33 +0000 (12:36 -0700)
Change-Id: Ibd224f9de595435524e683262882c9ebf2761abf

includes/Title.php
includes/api/ApiMove.php
includes/parser/CoreParserFunctions.php
includes/parser/Parser.php

index 05f85fa..b6a1689 100644 (file)
@@ -1324,7 +1324,7 @@ class Title implements LinkTarget {
         *
         * @since 1.30
         *
         *
         * @since 1.30
         *
-        * @return Title The object for the talk page,
+        * @return Title|null The object for the talk page,
         *         or null if no associated talk page can exist, according to canHaveTalkPage().
         */
        public function getTalkPageIfDefined() {
         *         or null if no associated talk page can exist, according to canHaveTalkPage().
         */
        public function getTalkPageIfDefined() {
index 1fb034f..e7b2808 100644 (file)
@@ -59,7 +59,7 @@ class ApiMove extends ApiBase {
                if ( !$toTitle || $toTitle->isExternal() ) {
                        $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['to'] ) ] );
                }
                if ( !$toTitle || $toTitle->isExternal() ) {
                        $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['to'] ) ] );
                }
-               $toTalk = $toTitle->canTalk() ? $toTitle->getTalkPage() : null;
+               $toTalk = $toTitle->getTalkPageIfDefined();
 
                if ( $toTitle->getNamespace() == NS_FILE
                        && !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
 
                if ( $toTitle->getNamespace() == NS_FILE
                        && !RepoGroup::singleton()->getLocalRepo()->findFile( $toTitle )
index f0f1f5f..3d26262 100644 (file)
@@ -582,14 +582,14 @@ class CoreParserFunctions {
        }
        public static function talkspace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
        }
        public static function talkspace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() ) {
+               if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
                        return '';
                }
                return str_replace( '_', ' ', $t->getTalkNsText() );
        }
        public static function talkspacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                        return '';
                }
                return str_replace( '_', ' ', $t->getTalkNsText() );
        }
        public static function talkspacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() ) {
+               if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
                        return '';
                }
                return wfUrlencode( $t->getTalkNsText() );
                        return '';
                }
                return wfUrlencode( $t->getTalkNsText() );
@@ -632,14 +632,14 @@ class CoreParserFunctions {
        }
        public static function fullpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
        }
        public static function fullpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() ) {
+               if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
                        return '';
                }
                return wfEscapeWikiText( $t->getPrefixedText() );
        }
        public static function fullpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                        return '';
                }
                return wfEscapeWikiText( $t->getPrefixedText() );
        }
        public static function fullpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() ) {
+               if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
                        return '';
                }
                return wfEscapeWikiText( $t->getPrefixedURL() );
                        return '';
                }
                return wfEscapeWikiText( $t->getPrefixedURL() );
@@ -688,14 +688,14 @@ class CoreParserFunctions {
        }
        public static function talkpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
        }
        public static function talkpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() ) {
+               if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
                        return '';
                }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
        }
        public static function talkpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                        return '';
                }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
        }
        public static function talkpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
-               if ( is_null( $t ) || !$t->canTalk() ) {
+               if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
                        return '';
                }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
                        return '';
                }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
index 3f0e38f..57e627e 100644 (file)
@@ -2586,7 +2586,7 @@ class Parser {
                                ) ) );
                                break;
                        case 'talkpagename':
                                ) ) );
                                break;
                        case 'talkpagename':
-                               if ( $this->mTitle->canTalk() ) {
+                               if ( $this->mTitle->canHaveTalkPage() ) {
                                        $talkPage = $this->mTitle->getTalkPage();
                                        $value = wfEscapeWikiText( $talkPage->getPrefixedText() );
                                } else {
                                        $talkPage = $this->mTitle->getTalkPage();
                                        $value = wfEscapeWikiText( $talkPage->getPrefixedText() );
                                } else {
@@ -2594,7 +2594,7 @@ class Parser {
                                }
                                break;
                        case 'talkpagenamee':
                                }
                                break;
                        case 'talkpagenamee':
-                               if ( $this->mTitle->canTalk() ) {
+                               if ( $this->mTitle->canHaveTalkPage() ) {
                                        $talkPage = $this->mTitle->getTalkPage();
                                        $value = wfEscapeWikiText( $talkPage->getPrefixedURL() );
                                } else {
                                        $talkPage = $this->mTitle->getTalkPage();
                                        $value = wfEscapeWikiText( $talkPage->getPrefixedURL() );
                                } else {
@@ -2694,12 +2694,12 @@ class Parser {
                                $value = $this->mTitle->getNamespace();
                                break;
                        case 'talkspace':
                                $value = $this->mTitle->getNamespace();
                                break;
                        case 'talkspace':
-                               $value = $this->mTitle->canTalk()
+                               $value = $this->mTitle->canHaveTalkPage()
                                        ? str_replace( '_', ' ', $this->mTitle->getTalkNsText() )
                                        : '';
                                break;
                        case 'talkspacee':
                                        ? str_replace( '_', ' ', $this->mTitle->getTalkNsText() )
                                        : '';
                                break;
                        case 'talkspacee':
-                               $value = $this->mTitle->canTalk() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : '';
+                               $value = $this->mTitle->canHaveTalkPage() ? wfUrlencode( $this->mTitle->getTalkNsText() ) : '';
                                break;
                        case 'subjectspace':
                                $value = str_replace( '_', ' ', $this->mTitle->getSubjectNsText() );
                                break;
                        case 'subjectspace':
                                $value = str_replace( '_', ' ', $this->mTitle->getSubjectNsText() );