aboutsummaryrefslogtreecommitdiffstats
path: root/includes/MediaWiki.php
diff options
context:
space:
mode:
authorJames D. Forrester <jforrester@wikimedia.org>2023-06-22 16:09:38 -0400
committerJames D. Forrester <jforrester@wikimedia.org>2023-06-23 14:58:05 -0400
commit1c8a63d8c02257c01c67147e51a2edc5736e851d (patch)
treec38f12e09a6bfbadf7005f3ed91e36dcbf5d15ed /includes/MediaWiki.php
parent36ba74999c7e51da17a9a14776fcf63b0323a5b1 (diff)
downloadmediawikicore-1c8a63d8c02257c01c67147e51a2edc5736e851d.tar.gz
mediawikicore-1c8a63d8c02257c01c67147e51a2edc5736e851d.zip
core: Replace deprecated calls to wfExpandUrl with UrlUtils::expand
Bug: T319340 Change-Id: I11e4508a5de996d3b3b5c0321b31aeb0a899f708
Diffstat (limited to 'includes/MediaWiki.php')
-rw-r--r--includes/MediaWiki.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php
index 8038988dccfb..fd2531315cbf 100644
--- a/includes/MediaWiki.php
+++ b/includes/MediaWiki.php
@@ -383,15 +383,17 @@ class MediaWiki {
return false;
}
+ $services = MediaWikiServices::getInstance();
+
if ( $title->isSpecialPage() ) {
- [ $name, $subpage ] = MediaWikiServices::getInstance()->getSpecialPageFactory()->
+ [ $name, $subpage ] = $services->getSpecialPageFactory()->
resolveAlias( $title->getDBkey() );
if ( $name ) {
$title = SpecialPage::getTitleFor( $name, $subpage );
}
}
// Redirect to canonical url, make it a 301 to allow caching
- $targetUrl = wfExpandUrl( $title->getFullURL(), PROTO_CURRENT );
+ $targetUrl = (string)$services->getUrlUtils()->expand( $title->getFullURL(), PROTO_CURRENT );
if ( $targetUrl == $request->getFullRequestURL() ) {
$message = "Redirect loop detected!\n\n" .
"This means the wiki got confused about what page was " .
@@ -960,8 +962,16 @@ class MediaWiki {
$force = $this->config->get( MainConfigNames::ForceHTTPS );
// Don't redirect if $wgServer is explicitly HTTP. We test for this here
- // by checking whether wfExpandUrl() is able to force HTTPS.
- if ( !preg_match( '#^https://#', wfExpandUrl( $request->getRequestURL(), PROTO_HTTPS ) ) ) {
+ // by checking whether UrlUtils::expand() is able to force HTTPS.
+ if (
+ !preg_match(
+ '#^https://#',
+ (string)MediaWikiServices::getInstance()->getUrlUtils()->expand(
+ $request->getRequestURL(),
+ PROTO_HTTPS
+ )
+ )
+ ) {
if ( $force ) {
throw new RuntimeException( '$wgForceHTTPS is true but the server is not HTTPS' );
}