58 \RequestContext::getMain()->getConfig()->
get(
'PHPSessionHandling' )
72 switch ( $PHPSessionHandling ) {
84 $this->enable =
false;
103 return self::$instance && self::$instance->enable;
111 if ( self::$instance ) {
117 if ( defined(
'MW_NO_SESSION_HANDLER' ) ) {
122 self::$instance =
new self(
$manager );
131 ini_set(
'session.use_cookies', 0 );
132 ini_set(
'session.use_trans_sid', 0 );
141 \Wikimedia\PhpSessionSerializer::setSerializeHandler();
161 if ( $this->manager !==
$manager ) {
163 if ( $this->manager ) {
169 \Wikimedia\PhpSessionSerializer::setLogger( $this->logger );
180 public function open( $save_path, $session_name ) {
181 if ( self::$instance !== $this ) {
184 if ( !$this->enable ) {
196 if ( self::$instance !== $this ) {
199 $this->sessionFieldCache = [];
210 if ( self::$instance !== $this ) {
213 if ( !$this->enable ) {
217 $session = $this->manager->getSessionById( $id,
false );
224 $this->sessionFieldCache[$id] =
$data;
225 return (
string)\Wikimedia\PhpSessionSerializer::encode(
$data );
237 public function write( $id, $dataStr ) {
238 if ( self::$instance !== $this ) {
241 if ( !$this->enable ) {
245 $session = $this->manager->getSessionById( $id,
true );
249 $this->logger->warning(
250 __METHOD__ .
': Session "{session}" cannot be loaded, skipping write.',
258 $data = \Wikimedia\PhpSessionSerializer::decode( $dataStr );
259 if (
$data ===
null ) {
267 $cache = $this->sessionFieldCache[$id] ?? [];
270 if ( $session->exists( $key ) ) {
272 $this->logger->warning(
273 __METHOD__ .
": Key \"$key\" added in both Session and \$_SESSION!"
277 $session->set( $key,
$value );
282 }
elseif ( !$session->exists( $key ) ) {
284 $this->logger->warning(
285 __METHOD__ .
": Key \"$key\" deleted in Session and changed in \$_SESSION!"
287 $session->set( $key,
$value );
291 $session->set( $key,
$value );
295 $this->logger->warning(
296 __METHOD__ .
": Key \"$key\" changed in both Session and \$_SESSION!"
302 \Wikimedia\PhpSessionSerializer::setLogger(
new \Psr\Log\NullLogger() );
305 \
Wikimedia\PhpSessionSerializer::encode( [ $key =>
true ] )
307 if (
$cache[$key] === $session->get( $key ) ) {
309 $session->remove( $key );
313 $this->logger->warning(
314 __METHOD__ .
": Key \"$key\" changed in Session and deleted in \$_SESSION!"
319 \Wikimedia\PhpSessionSerializer::setLogger( $this->logger );
325 $this->logger->warning(
'Something wrote to $_SESSION!' );
344 if ( self::$instance !== $this ) {
347 if ( !$this->enable ) {
350 $session = $this->manager->getSessionById( $id,
false );
364 public function gc( $maxlifetime ) {
365 if ( self::$instance !== $this ) {
368 $before = date(
'YmdHis', time() );
369 $this->store->deleteObjectsExpiringBefore( $before );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Class representing a cache/ephemeral data store.
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))