本文整理汇总了PHP中wfFixSessionID函数的典型用法代码示例。如果您正苦于以下问题:PHP wfFixSessionID函数的具体用法?PHP wfFixSessionID怎么用?PHP wfFixSessionID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfFixSessionID函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfSetupSession
/**
* Initialise php session
*
* @param bool $sessionId
*/
function wfSetupSession($sessionId = false)
{
global $wgSessionsInMemcached, $wgSessionsInObjectCache, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
if ($wgSessionsInObjectCache || $wgSessionsInMemcached) {
ObjectCacheSessionHandler::install();
} elseif ($wgSessionHandler && $wgSessionHandler != ini_get('session.save_handler')) {
# Only set this if $wgSessionHandler isn't null and session.save_handler
# 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');
if ($sessionId) {
session_id($sessionId);
} else {
wfFixSessionID();
}
MediaWiki\suppressWarnings();
session_start();
MediaWiki\restoreWarnings();
}
示例2: wfSetupSession
/**
* Initialise php session
*
* @param $sessionId Bool
*/
function wfSetupSession($sessionId = false)
{
global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
if ($wgSessionsInMemcached) {
if (!defined('MW_COMPILED')) {
global $IP;
require_once "{$IP}/includes/cache/MemcachedSessions.php";
}
session_set_save_handler('memsess_open', 'memsess_close', 'memsess_read', 'memsess_write', 'memsess_destroy', 'memsess_gc');
// It's necessary to register a shutdown function to call session_write_close(),
// because by the time the request shutdown function for the session module is
// called, $wgMemc has already been destroyed. Shutdown functions registered
// this way are called before object destruction.
register_shutdown_function('memsess_write_close');
} elseif ($wgSessionHandler && $wgSessionHandler != ini_get('session.save_handler')) {
# Only set this if $wgSessionHandler isn't null and session.save_handler
# hasn't already been set to the desired value (that causes errors)
ini_set('session.save_handler', $wgSessionHandler);
}
$httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
wfDebugLog('cookie', 'session_set_cookie_params: "' . implode('", "', array(0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe)) . '"');
session_set_cookie_params(0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe);
session_cache_limiter('private, must-revalidate');
if ($sessionId) {
session_id($sessionId);
} else {
wfFixSessionID();
}
wfSuppressWarnings();
session_start();
wfRestoreWarnings();
}
示例3: wfSetupSession
/**
* Initialise php session
*
* @param $sessionId Bool
*/
function wfSetupSession($sessionId = false)
{
global $wgSessionsInMemcached, $wgSessionsInObjectCache, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
if ($wgSessionsInObjectCache || $wgSessionsInMemcached) {
ObjectCacheSessionHandler::install();
} elseif ($wgSessionHandler && $wgSessionHandler != ini_get('session.save_handler')) {
# Only set this if $wgSessionHandler isn't null and session.save_handler
# hasn't already been set to the desired value (that causes errors)
ini_set('session.save_handler', $wgSessionHandler);
}
$httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
wfDebugLog('cookie', 'session_set_cookie_params: "' . implode('", "', array(0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe)) . '"');
session_set_cookie_params(0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe);
session_cache_limiter('private, must-revalidate');
if ($sessionId) {
session_id($sessionId);
} else {
wfFixSessionID();
}
wfSuppressWarnings();
session_start();
wfRestoreWarnings();
}
示例4: wfSetupSession
/**
* Initialise php session
*
* @param $sessionId Bool
*/
function wfSetupSession($sessionId = false)
{
global $wgSessionsInMemcached, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $wgCookieHttpOnly, $wgSessionHandler;
if ($wgSessionsInMemcached) {
if (!defined('MW_COMPILED')) {
global $IP;
require_once "{$IP}/includes/cache/MemcachedSessions.php";
}
session_set_save_handler('memsess_open', 'memsess_close', 'memsess_read', 'memsess_write', 'memsess_destroy', 'memsess_gc');
// It's necessary to register a shutdown function to call session_write_close(),
// because by the time the request shutdown function for the session module is
// called, $wgMemc has already been destroyed. Shutdown functions registered
// this way are called before object destruction.
register_shutdown_function('memsess_write_close');
} elseif ($wgSessionHandler && $wgSessionHandler != ini_get('session.save_handler')) {
# Only set this if $wgSessionHandler isn't null and session.save_handler
# hasn't already been set to the desired value (that causes errors)
ini_set('session.save_handler', $wgSessionHandler);
}
$httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
wfDebugLog('cookie', 'session_set_cookie_params: "' . implode('", "', array(0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe)) . '"');
session_set_cookie_params(0, $wgCookiePath, $wgCookieDomain, $wgCookieSecure, $httpOnlySafe);
session_cache_limiter('private, must-revalidate');
if ($sessionId) {
session_id($sessionId);
} else {
wfFixSessionID();
}
wfSuppressWarnings();
session_start();
wfRestoreWarnings();
// Wikia change - start
// log all sessions started with 1% sampling (PLATFORM-1266)
if ((new Wikia\Util\Statistics\BernoulliTrial(0.01))->shouldSample()) {
Wikia\Logger\WikiaLogger::instance()->info(__METHOD__, ['caller' => wfGetAllCallers(), 'exception' => new Exception()]);
}
// Wikia change - end
}