Albert221 has uploaded a new change for review. https://gerrit.wikimedia.org/r/258524
Change subject: Resolve code invoking Title::newFromURL ...................................................................... Resolve code invoking Title::newFromURL Bug: T65424 Change-Id: I6c97245faccd8b34557eb3be4150867fd9b37992 --- M includes/MediaWiki.php M includes/OutputPage.php M includes/parser/CoreParserFunctions.php M includes/specials/SpecialListfiles.php M includes/specials/SpecialMergeHistory.php M includes/specials/SpecialNewimages.php M includes/specials/SpecialRecentchangeslinked.php M includes/specials/SpecialUndelete.php M includes/specials/SpecialWhatlinkshere.php 9 files changed, 10 insertions(+), 17 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/24/258524/1 diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 409d9e0..7c567ef 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -71,7 +71,7 @@ // URLs like this are generated by RC, because rc_title isn't always accurate $ret = Title::newFromID( $curid ); } else { - $ret = Title::newFromURL( $title ); + $ret = Title::newFromText( $title ); // Alias NS_MEDIA page URLs to NS_FILE...we only use NS_MEDIA // in wikitext links to tell Parser to make a direct file link if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index ea85358..fea667e 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2439,7 +2439,7 @@ # not especially useful as a returnto parameter. Use the title # from the request instead, if there was one. $request = $this->getRequest(); - $returnto = Title::newFromURL( $request->getVal( 'title', '' ) ); + $returnto = Title::newFromText( $request->getVal( 'title', '' ) ); if ( $action == 'edit' ) { $msg = 'whitelistedittext'; $displayReturnto = $returnto; diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index d25d11a..e249f80 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -266,13 +266,6 @@ public static function urlFunction( $func, $s = '', $arg = null ) { $title = Title::newFromText( $s ); - # Due to order of execution of a lot of bits, the values might be encoded - # before arriving here; if that's true, then the title can't be created - # and the variable will fail. If we can't get a decent title from the first - # attempt, url-decode and try for a second. - if ( is_null( $title ) ) { - $title = Title::newFromURL( urldecode( $s ) ); - } if ( !is_null( $title ) ) { # Convert NS_MEDIA -> NS_FILE if ( $title->getNamespace() == NS_MEDIA ) { diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 3ea56c6..8de4e2f 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -108,7 +108,7 @@ if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) { $this->mSearch = $search; - $nt = Title::newFromURL( $this->mSearch ); + $nt = Title::newFromText( $this->mSearch ); if ( $nt ) { $dbr = wfGetDB( DB_SLAVE ); @@ -147,7 +147,7 @@ } if ( $this->mSearch !== '' ) { - $nt = Title::newFromURL( $this->mSearch ); + $nt = Title::newFromText( $this->mSearch ); if ( $nt ) { $dbr = wfGetDB( DB_SLAVE ); $conds[] = 'LOWER(' . $prefix . '_name)' . diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index ef1fd73..f11ed9a 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -91,8 +91,8 @@ // target page if ( $this->mSubmitted ) { - $this->mTargetObj = Title::newFromURL( $this->mTarget ); - $this->mDestObj = Title::newFromURL( $this->mDest ); + $this->mTargetObj = Title::newFromText( $this->mTarget ); + $this->mDestObj = Title::newFromText( $this->mDest ); } else { $this->mTargetObj = null; $this->mDestObj = null; diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 00c8e05..6b7c038 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -113,7 +113,7 @@ if ( !$this->getConfig()->get( 'MiserMode' ) && $this->like !== null ) { $dbr = wfGetDB( DB_SLAVE ); - $likeObj = Title::newFromURL( $this->like ); + $likeObj = Title::newFromText( $this->like ); if ( $likeObj instanceof Title ) { $like = $dbr->buildLike( $dbr->anyString(), diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index e947586..7da00a3 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -55,7 +55,7 @@ return false; } $outputPage = $this->getOutput(); - $title = Title::newFromURL( $target ); + $title = Title::newFromText( $target ); if ( !$title || $title->isExternal() ) { $outputPage->addHtml( '<div class="errorbox">' . $this->msg( 'allpagesbadtitle' ) ->parse() . '</div>' ); diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 4c79c92..0e0b9df 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -700,7 +700,7 @@ $this->mTargetObj = null; if ( $this->mTarget !== null && $this->mTarget !== '' ) { - $this->mTargetObj = Title::newFromURL( $this->mTarget ); + $this->mTargetObj = Title::newFromText( $this->mTarget ); } $this->mSearchPrefix = $request->getText( 'prefix' ); diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 0e5ffce..f46f570 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -72,7 +72,7 @@ // Bind to member variable $this->opts = $opts; - $this->target = Title::newFromURL( $opts->getValue( 'target' ) ); + $this->target = Title::newFromText( $opts->getValue( 'target' ) ); if ( !$this->target ) { if ( !$this->including() ) { $out->addHTML( $this->whatlinkshereForm() ); -- To view, visit https://gerrit.wikimedia.org/r/258524 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6c97245faccd8b34557eb3be4150867fd9b37992 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Albert221 <w.albert...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits