[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; 13 14 /** 15 * Wraps another SessionHandlerInterface to only write the session when it has been modified. 16 * 17 * @author Adrien Brault <adrien.brault@gmail.com> 18 */ 19 class WriteCheckSessionHandler implements \SessionHandlerInterface 20 { 21 private $wrappedSessionHandler; 22 23 /** 24 * @var array sessionId => session 25 */ 26 private $readSessions; 27 28 public function __construct(\SessionHandlerInterface $wrappedSessionHandler) 29 { 30 $this->wrappedSessionHandler = $wrappedSessionHandler; 31 } 32 33 /** 34 * {@inheritdoc} 35 */ 36 public function close() 37 { 38 return $this->wrappedSessionHandler->close(); 39 } 40 41 /** 42 * {@inheritdoc} 43 */ 44 public function destroy($sessionId) 45 { 46 return $this->wrappedSessionHandler->destroy($sessionId); 47 } 48 49 /** 50 * {@inheritdoc} 51 */ 52 public function gc($maxlifetime) 53 { 54 return $this->wrappedSessionHandler->gc($maxlifetime); 55 } 56 57 /** 58 * {@inheritdoc} 59 */ 60 public function open($savePath, $sessionName) 61 { 62 return $this->wrappedSessionHandler->open($savePath, $sessionName); 63 } 64 65 /** 66 * {@inheritdoc} 67 */ 68 public function read($sessionId) 69 { 70 $session = $this->wrappedSessionHandler->read($sessionId); 71 72 $this->readSessions[$sessionId] = $session; 73 74 return $session; 75 } 76 77 /** 78 * {@inheritdoc} 79 */ 80 public function write($sessionId, $data) 81 { 82 if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) { 83 return true; 84 } 85 86 return $this->wrappedSessionHandler->write($sessionId, $data); 87 } 88 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |