X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=25876fb99a28fb63aba843c8a450e5933024c615;hb=22bf875d152751f5590508a1f44976c9db30cb44;hp=cefa37537ad6e331a0b2b6cc2990c0e96739c55b;hpb=b5ede59859e629e0548cf8b891de2e08d859dee6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index cefa37537a..25876fb99a 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -170,13 +170,13 @@ if ( !function_exists( 'hash_equals' ) ) { * This queues an extension to be loaded through * the ExtensionRegistry system. * - * @param string $name Name of the extension to load + * @param string $ext Name of the extension to load * @param string|null $path Absolute path of where to find the extension.json file */ -function wfLoadExtension( $name, $path = null ) { +function wfLoadExtension( $ext, $path = null ) { if ( !$path ) { - global $IP; - $path = "$IP/extensions/$name/extension.json"; + global $wgExtensionDirectory; + $path = "$wgExtensionDirectory/$ext/extension.json"; } ExtensionRegistry::getInstance()->queue( $path ); } @@ -194,10 +194,10 @@ function wfLoadExtension( $name, $path = null ) { * @param string[] $exts Array of extension names to load */ function wfLoadExtensions( array $exts ) { - global $IP; + global $wgExtensionDirectory; $registry = ExtensionRegistry::getInstance(); foreach ( $exts as $ext ) { - $registry->queue( "$IP/extensions/$ext/extension.json" ); + $registry->queue( "$wgExtensionDirectory/$ext/extension.json" ); } } @@ -205,13 +205,13 @@ function wfLoadExtensions( array $exts ) { * Load a skin * * @see wfLoadExtension - * @param string $name Name of the extension to load + * @param string $skin Name of the extension to load * @param string|null $path Absolute path of where to find the skin.json file */ -function wfLoadSkin( $name, $path = null ) { +function wfLoadSkin( $skin, $path = null ) { if ( !$path ) { - global $IP; - $path = "$IP/skins/$name/skin.json"; + global $wgStyleDirectory; + $path = "$wgStyleDirectory/$skin/skin.json"; } ExtensionRegistry::getInstance()->queue( $path ); } @@ -223,10 +223,10 @@ function wfLoadSkin( $name, $path = null ) { * @param string[] $skins Array of extension names to load */ function wfLoadSkins( array $skins ) { - global $IP; + global $wgStyleDirectory; $registry = ExtensionRegistry::getInstance(); foreach ( $skins as $skin ) { - $registry->queue( "$IP/skins/$skin/skin.json" ); + $registry->queue( "$wgStyleDirectory/$skin/skin.json" ); } } @@ -2129,15 +2129,14 @@ function wfVarDump( $var ) { */ function wfHttpError( $code, $label, $desc ) { global $wgOut; - header( "HTTP/1.0 $code $label" ); - header( "Status: $code $label" ); + HttpStatus::header( $code ); if ( $wgOut ) { $wgOut->disable(); $wgOut->sendCacheControl(); } header( 'Content-type: text/html; charset=utf-8' ); - print "" . + print '' . '' . htmlspecialchars( $label ) . '

' . @@ -3353,7 +3352,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, // Removing leading zeros works around broken base detection code in // some PHP versions (see and // ). - $result = gmp_strval( gmp_init( ltrim( $input, '0' ), $sourceBase ), $destBase ); + $result = gmp_strval( gmp_init( ltrim( $input, '0' ) ?: '0', $sourceBase ), $destBase ); } elseif ( extension_loaded( 'bcmath' ) && ( $engine == 'auto' || $engine == 'bcmath' ) ) { $decimal = '0'; foreach ( str_split( strtolower( $input ) ) as $char ) { @@ -3755,6 +3754,7 @@ function wfWaitForSlaves( } // Figure out which clusters need to be checked + /** @var LoadBalancer[] $lbs */ $lbs = array(); if ( $cluster === '*' ) { wfGetLBFactory()->forEachLB( function ( LoadBalancer $lb ) use ( &$lbs ) {