X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=d21cc1d749cb69e24cd315ebfa6dc42a169dc9d0;hb=3b70100a856c511b0a84eed2e522dabb0b332cd2;hp=8b857eae8b56241b6addf12c8b0d9a8dd428a436;hpb=72540f0cb00da0e457618ae15aa466a6a90d2cfb;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 8b857eae8b..d21cc1d749 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -27,6 +27,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { use Liuggio\StatsdClient\Sender\SocketSender; use MediaWiki\Logger\LoggerFactory; use MediaWiki\Session\SessionManager; +use MediaWiki\MediaWikiServices; use Wikimedia\ScopedCallback; use Wikimedia\Rdbms\DBReplicationWaitError; @@ -1198,7 +1199,9 @@ function wfLogProfilingData() { $statsdSender = new SocketSender( $statsdHost, $statsdPort ); $statsdClient = new SamplingStatsdClient( $statsdSender, true, false ); $statsdClient->setSamplingRates( $config->get( 'StatsdSamplingRates' ) ); - $statsdClient->send( $context->getStats()->getBuffer() ); + $statsdClient->send( + MediaWikiServices::getInstance()->getStatsdDataFactory()->getBuffer() + ); } catch ( Exception $ex ) { MWExceptionHandler::logException( $ex ); } @@ -1263,7 +1266,7 @@ function wfLogProfilingData() { * @return void */ function wfIncrStats( $key, $count = 1 ) { - $stats = RequestContext::getMain()->getStats(); + $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); $stats->updateCount( $key, $count ); } @@ -1433,7 +1436,6 @@ function wfMsgReplaceArgs( $message, $args ) { function wfHostname() { static $host; if ( is_null( $host ) ) { - # Hostname overriding global $wgOverrideHostname; if ( $wgOverrideHostname !== false ) { @@ -2532,8 +2534,15 @@ function wfShellExecWithStderr( $cmd, &$retval = null, $environ = [], $limits = } /** - * Workaround for https://bugs.php.net/bug.php?id=45132 - * escapeshellarg() destroys non-ASCII characters if LANG is not a UTF-8 locale + * Set the locale for locale-sensitive operations + * + * Sets LC_ALL to a known value to work around issues like the following: + * - https://bugs.php.net/bug.php?id=45132 escapeshellarg() destroys non-ASCII + * characters if LANG is not a UTF-8 locale + * - T107128 Scribunto string comparison works case insensitive while the + * standard Lua case sensitive + * + * @see $wgShellLocale */ function wfInitShellLocale() { static $done = false; @@ -2542,8 +2551,8 @@ function wfInitShellLocale() { } $done = true; global $wgShellLocale; - putenv( "LC_CTYPE=$wgShellLocale" ); - setlocale( LC_CTYPE, $wgShellLocale ); + putenv( "LC_ALL=$wgShellLocale" ); + setlocale( LC_ALL, $wgShellLocale ); } /**