Yurik has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/92041


Change subject: Logic optimization for wfExpandUrl()
......................................................................

Logic optimization for wfExpandUrl()

removed redundant checks of the same variable, making the code
slightly more efficient

Change-Id: Ice4d3c45e80ca1214e2c36444baf0ce87b15a59b
---
M includes/GlobalFunctions.php
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/41/92041/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 77c09e5..ae42186 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -493,16 +493,16 @@
  */
 function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) {
        global $wgServer, $wgCanonicalServer, $wgInternalServer;
-       $serverUrl = $wgServer;
        if ( $defaultProto === PROTO_CANONICAL ) {
                $serverUrl = $wgCanonicalServer;
-       }
-       // Make $wgInternalServer fall back to $wgServer if not set
-       if ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== false ) {
+       } elseif ( $defaultProto === PROTO_INTERNAL && $wgInternalServer !== 
false ) {
+               // Make $wgInternalServer fall back to $wgServer if not set
                $serverUrl = $wgInternalServer;
-       }
-       if ( $defaultProto === PROTO_CURRENT ) {
-               $defaultProto = WebRequest::detectProtocol() . '://';
+       } else {
+               $serverUrl = $wgServer;
+               if ( $defaultProto === PROTO_CURRENT ) {
+                       $defaultProto = WebRequest::detectProtocol() . '://';
+               }
        }
 
        // Analyze $serverUrl to obtain its protocol

-- 
To view, visit https://gerrit.wikimedia.org/r/92041
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice4d3c45e80ca1214e2c36444baf0ce87b15a59b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to