X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=57877a2b0f2f93873d0ff6c33ce4cf17d78339c8;hb=b114344cd9b7b2cb3e4887a25ad6c69c8146e810;hp=93a2b029f0355f4050d6af9f00246cb67390d970;hpb=8d7c0346307d94c679109a41e1a93fa93c921edf;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 93a2b029f0..57877a2b0f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -496,18 +496,19 @@ function wfAppendQuery( $url, $query ) { */ function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) { global $wgServer, $wgCanonicalServer, $wgInternalServer, $wgRequest; - $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 = $wgRequest->getProtocol() . '://'; + } else { + $serverUrl = $wgServer; + if ( $defaultProto === PROTO_CURRENT ) { + $defaultProto = $wgRequest->getProtocol() . '://'; + } } + // Analyze $serverUrl to obtain its protocol $bits = wfParseUrl( $serverUrl ); $serverHasProto = $bits && $bits['scheme'] != ''; @@ -2855,6 +2856,15 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), if ( $useLogPipe ) { $desc[3] = array( 'pipe', 'w' ); } + + # TODO/FIXME: This is a bad hack to workaround an HHVM bug that prevents + # proc_open() from opening stdin/stdout, so use /dev/null *for now* + # See bug 56597 / https://github.com/facebook/hhvm/issues/1247 for more info + if ( wfIsHHVM() ) { + $desc[0] = array( 'file', '/dev/null', 'r' ); + $desc[2] = array( 'file', '/dev/null', 'w' ); + } + $pipes = null; $proc = proc_open( $cmd, $desc, $pipes ); if ( !$proc ) { @@ -3800,7 +3810,7 @@ function wfGetNull() { * @param string|bool $cluster Cluster name accepted by LBFactory. Default: false. */ function wfWaitForSlaves( $maxLag = false, $wiki = false, $cluster = false ) { - if( $cluster !== false ) { + if ( $cluster !== false ) { $lb = wfGetLBFactory()->getExternalLB( $cluster ); } else { $lb = wfGetLB( $wiki );