MediaWiki REL1_31
|
Adapter for PHP's session handling. More...
Public Member Functions | |
close () | |
Close the session (handler) | |
destroy ( $id) | |
Destroy a session. | |
gc ( $maxlifetime) | |
Execute garbage collection. | |
open ( $save_path, $session_name) | |
Initialize the session (handler) | |
read ( $id) | |
Read session data. | |
setManager (SessionManager $manager, BagOStuff $store, LoggerInterface $logger) | |
Set the manager, store, and logger. | |
write ( $id, $dataStr) | |
Write session data. | |
Static Public Member Functions | |
static | install (SessionManager $manager) |
Install a session handler for the current web request. | |
static | isEnabled () |
Test whether the handler is installed and enabled. | |
static | isInstalled () |
Test whether the handler is installed. | |
Protected Member Functions | |
__construct (SessionManager $manager) | |
Static Protected Member Functions | |
static | returnFailure () |
Workaround for PHP5 bug. | |
static | returnSuccess () |
Workaround for PHP5 bug. | |
Protected Attributes | |
bool | $enable = false |
Whether PHP session handling is enabled. | |
LoggerInterface | $logger |
SessionManager null | $manager |
array | $sessionFieldCache = [] |
Track original session fields for later modification check. | |
BagOStuff null | $store |
$warn = true | |
Static Protected Attributes | |
static PHPSessionHandler | $instance = null |
Private Member Functions | |
setEnableFlags ( $PHPSessionHandling) | |
Set $this->enable and $this->warn. | |
|
protected |
Definition at line 54 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\$manager, RequestContext\getMain(), MediaWiki\Session\PHPSessionHandler\setEnableFlags(), and MediaWiki\Session\SessionManager\setupPHPSessionHandler().
MediaWiki\Session\PHPSessionHandler::close | ( | ) |
Close the session (handler)
Definition at line 220 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\returnSuccess().
MediaWiki\Session\PHPSessionHandler::destroy | ( | $id | ) |
Destroy a session.
string | $id | Session id |
Definition at line 368 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\returnSuccess().
MediaWiki\Session\PHPSessionHandler::gc | ( | $maxlifetime | ) |
Execute garbage collection.
int | $maxlifetime | Maximum session life time (ignored) |
Definition at line 389 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\returnSuccess().
|
static |
Install a session handler for the current web request.
SessionManager | $manager |
Definition at line 108 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\$manager, and MediaWiki\Session\SessionManager\setupPHPSessionHandler().
Referenced by MediaWiki\Session\TestUtils\setSessionManagerSingleton(), MediaWiki\Session\SessionManagerTest\testGetGlobalSession(), MediaWiki\Session\PHPSessionHandlerTest\testInstall(), MediaWiki\Session\SessionBackendTest\testResetIdOfGlobalSession(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), MediaWiki\Session\SessionBackendTest\testTakeOverGlobalSession(), and MediaWiki\Session\SessionBackendTest\testUnpersistOfGlobalSession().
|
static |
Test whether the handler is installed and enabled.
Definition at line 100 of file PHPSessionHandler.php.
Referenced by MediaWiki\Session\SessionBackend\checkPHPSession(), MediaWiki\Session\SessionManager\getGlobalSession(), MediaWiki\Session\SessionBackend\resetId(), MediaWiki\Session\PHPSessionHandlerTest\testEnableFlags(), MediaWiki\Session\SessionBackendTest\testResetIdOfGlobalSession(), MediaWiki\Session\SessionBackendTest\testTakeOverGlobalSession(), MediaWiki\Session\SessionBackendTest\testUnpersistOfGlobalSession(), and MediaWiki\Session\SessionBackend\unpersist().
|
static |
Test whether the handler is installed.
Definition at line 92 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\$instance.
Referenced by MediaWiki\Session\TestUtils\setSessionManagerSingleton(), MediaWiki\Session\SessionManagerTest\testGetGlobalSession(), MediaWiki\Session\PHPSessionHandlerTest\testInstall(), MediaWiki\Session\SessionBackendTest\testResetIdOfGlobalSession(), MediaWiki\Session\SessionBackendTest\testTakeOverGlobalSession(), and MediaWiki\Session\SessionBackendTest\testUnpersistOfGlobalSession().
MediaWiki\Session\PHPSessionHandler::open | ( | $save_path, | |
$session_name ) |
Initialize the session (handler)
string | $save_path | Path used to store session files (ignored) |
string | $session_name | Session name (ignored) |
Definition at line 205 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\returnSuccess().
MediaWiki\Session\PHPSessionHandler::read | ( | $id | ) |
Read session data.
string | $id | Session id |
Definition at line 234 of file PHPSessionHandler.php.
|
staticprotected |
Workaround for PHP5 bug.
Definition at line 194 of file PHPSessionHandler.php.
References false.
Referenced by MediaWiki\Session\PHPSessionHandler\write().
|
staticprotected |
Workaround for PHP5 bug.
PHP5 has a bug in handling boolean return values for SessionHandlerInterface methods, it expects 0 or -1 instead of true or false. See https://wiki.php.net/rfc/session.user.return-value.
PHP7 and HHVM are not affected.
Definition at line 184 of file PHPSessionHandler.php.
References true.
Referenced by MediaWiki\Session\PHPSessionHandler\close(), MediaWiki\Session\PHPSessionHandler\destroy(), MediaWiki\Session\PHPSessionHandler\gc(), MediaWiki\Session\PHPSessionHandler\open(), and MediaWiki\Session\PHPSessionHandler\write().
|
private |
Set $this->enable and $this->warn.
Separate just because there doesn't seem to be a good way to test it otherwise.
string | $PHPSessionHandling | See $wgPHPSessionHandling |
Definition at line 69 of file PHPSessionHandler.php.
Referenced by MediaWiki\Session\PHPSessionHandler\__construct().
MediaWiki\Session\PHPSessionHandler::setManager | ( | SessionManager | $manager, |
BagOStuff | $store, | ||
LoggerInterface | $logger ) |
Set the manager, store, and logger.
SessionManager | $manager | |
BagOStuff | $store | |
LoggerInterface | $logger |
Definition at line 156 of file PHPSessionHandler.php.
References MediaWiki\Session\PHPSessionHandler\$logger, MediaWiki\Session\PHPSessionHandler\$manager, and MediaWiki\Session\PHPSessionHandler\$store.
MediaWiki\Session\PHPSessionHandler::write | ( | $id, | |
$dataStr ) |
Write session data.
string | $id | Session id |
string | $dataStr | Session data. Not that you should ever call this directly, but note that this has the same issues with code injection via user-controlled data as does PHP's unserialize function. |
Definition at line 262 of file PHPSessionHandler.php.
References $cache, $value, MediaWiki\Session\PHPSessionHandler\returnFailure(), MediaWiki\Session\PHPSessionHandler\returnSuccess(), and wfDeprecated().
|
protected |
Whether PHP session handling is enabled.
Definition at line 39 of file PHPSessionHandler.php.
|
staticprotected |
Definition at line 36 of file PHPSessionHandler.php.
Referenced by MediaWiki\Session\PHPSessionHandler\isInstalled().
|
protected |
Definition at line 49 of file PHPSessionHandler.php.
Referenced by MediaWiki\Session\PHPSessionHandler\setManager().
|
protected |
Definition at line 43 of file PHPSessionHandler.php.
Referenced by MediaWiki\Session\PHPSessionHandler\__construct(), MediaWiki\Session\PHPSessionHandler\install(), and MediaWiki\Session\PHPSessionHandler\setManager().
|
protected |
Track original session fields for later modification check.
Definition at line 52 of file PHPSessionHandler.php.
|
protected |
Definition at line 46 of file PHPSessionHandler.php.
Referenced by MediaWiki\Session\PHPSessionHandler\setManager().
|
protected |
Definition at line 40 of file PHPSessionHandler.php.