X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=f2720df38f912a3b822e6f6d1b5576a02ac2c37a;hb=2f918ef4a2ad5a554a728b7a4d9c150254988951;hp=167305d9abe8d50b46ab505ec336e01bee8435ff;hpb=d5d85f2db20896b2c66a7a809fbe9a1049d73856;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 167305d9ab..f2720df38f 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -24,7 +24,6 @@ if ( !defined( 'MEDIAWIKI' ) ) { die( "This file is part of MediaWiki, it is not a valid entry point" ); } -use Liuggio\StatsdClient\StatsdClient; use Liuggio\StatsdClient\Sender\SocketSender; use MediaWiki\Logger\LoggerFactory; @@ -1259,7 +1258,7 @@ function wfLogProfilingData() { $statsdHost = $statsdServer[0]; $statsdPort = isset( $statsdServer[1] ) ? $statsdServer[1] : 8125; $statsdSender = new SocketSender( $statsdHost, $statsdPort ); - $statsdClient = new StatsdClient( $statsdSender, true, false ); + $statsdClient = new SamplingStatsdClient( $statsdSender, true, false ); $statsdClient->send( $context->getStats()->getBuffer() ); } catch ( Exception $ex ) { MWExceptionHandler::logException( $ex ); @@ -3462,8 +3461,9 @@ function wfResetSessionID() { * @param bool $sessionId */ function wfSetupSession( $sessionId = false ) { - global $wgSessionsInMemcached, $wgSessionsInObjectCache, $wgCookiePath, $wgCookieDomain, - $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler; + global $wgSessionsInMemcached, $wgSessionsInObjectCache, $wgSessionHandler; + global $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly; + if ( $wgSessionsInObjectCache || $wgSessionsInMemcached ) { ObjectCacheSessionHandler::install(); } elseif ( $wgSessionHandler && $wgSessionHandler != ini_get( 'session.save_handler' ) ) { @@ -3471,6 +3471,7 @@ function wfSetupSession( $sessionId = false ) { # hasn't already been set to the desired value (that causes errors) ini_set( 'session.save_handler', $wgSessionHandler ); } + session_set_cookie_params( 0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly ); session_cache_limiter( 'private, must-revalidate' ); @@ -3479,9 +3480,14 @@ function wfSetupSession( $sessionId = false ) { } else { wfFixSessionID(); } + MediaWiki\suppressWarnings(); session_start(); MediaWiki\restoreWarnings(); + + if ( $wgSessionsInObjectCache || $wgSessionsInMemcached ) { + ObjectCacheSessionHandler::renewCurrentSession(); + } } /** @@ -3842,9 +3848,9 @@ function wfStripIllegalFilenameChars( $name ) { } /** - * Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit; + * Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit * - * @return int Value the memory limit was set to. + * @return int Prior memory limit */ function wfMemoryLimit() { global $wgMemoryLimit; @@ -3868,6 +3874,26 @@ function wfMemoryLimit() { return $memlimit; } +/** + * Set PHP's time limit to the larger of php.ini or $wgTransactionalTimeLimit + * + * @return int Prior time limit + * @since 1.26 + */ +function wfTransactionalTimeLimit() { + global $wgTransactionalTimeLimit; + + $timeLimit = ini_get( 'max_execution_time' ); + // Note that CLI scripts use 0 + if ( $timeLimit > 0 && $wgTransactionalTimeLimit > $timeLimit ) { + set_time_limit( $wgTransactionalTimeLimit ); + } + + ignore_user_abort( true ); // ignore client disconnects + + return $timeLimit; +} + /** * Converts shorthand byte notation to integer form *