Loading core/modules/user/src/TempStore.php +5 −5 Changes for core/modules/user/src/TempStore.php: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -65,11 +65,8 @@ class TempStore { * By default, data is stored for one week (604800 seconds) before expiring. * * @var int * * @todo Currently, this property is not exposed anywhere, and so the only * way to override it is by extending the class. */ protected $expire = 604800; protected $expire; /** * Constructs a new object for accessing data from a key/value store. Loading @@ -82,11 +79,14 @@ class TempStore { * The lock object used for this data. * @param mixed $owner * The owner key to store along with the data (e.g. a user or session ID). * @param int $expire * The time to live for items, in seconds. */ public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lockBackend, $owner) { public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lockBackend, $owner, $expire = 604800) { $this->storage = $storage; $this->lockBackend = $lockBackend; $this->owner = $owner; $this->expire = $expire; } /** Loading core/modules/user/src/TempStoreFactory.php +12 −2 Changes for core/modules/user/src/TempStoreFactory.php: 12 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -38,6 +38,13 @@ class TempStoreFactory { */ protected $lockBackend; /** * The time to live for items in seconds. * * @var int */ protected $expire; /** * Constructs a Drupal\user\TempStoreFactory object. * Loading @@ -47,11 +54,14 @@ class TempStoreFactory { * The connection object used for this data. * @param \Drupal\Core\Lock\LockBackendInterface $lockBackend * The lock object used for this data. * @param int $expire * The time to live for items, in seconds. */ function __construct(SerializationInterface $serializer, Connection $connection, LockBackendInterface $lockBackend) { function __construct(SerializationInterface $serializer, Connection $connection, LockBackendInterface $lockBackend, $expire = 604800) { $this->serializer = $serializer; $this->connection = $connection; $this->lockBackend = $lockBackend; $this->expire = $expire; } /** Loading @@ -77,7 +87,7 @@ function get($collection, $owner = NULL) { // Store the data for this collection in the database. $storage = new DatabaseStorageExpirable($collection, $this->serializer, $this->connection); return new TempStore($storage, $this->lockBackend, $owner); return new TempStore($storage, $this->lockBackend, $owner, $this->expire); } } core/modules/user/tests/src/TempStoreTest.php +1 −1 Changes for core/modules/user/tests/src/TempStoreTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ protected function setUp() { $this->keyValue = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface'); $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface'); $this->tempStore = new TempStore($this->keyValue, $this->lock, $this->owner); $this->tempStore = new TempStore($this->keyValue, $this->lock, $this->owner, 604800); $this->ownObject = (object) array( 'data' => 'test_data', Loading core/modules/user/user.services.yml +4 −1 Changes for core/modules/user/user.services.yml: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -54,4 +54,7 @@ services: arguments: ['@entity.manager', '@password'] user.tempstore: class: Drupal\user\TempStoreFactory arguments: ['@serialization.phpserialize', '@database', '@lock'] arguments: ['@serialization.phpserialize', '@database', '@lock', '%user.tempstore.expire%'] parameters: user.tempstore.expire: 604800 Loading
core/modules/user/src/TempStore.php +5 −5 Changes for core/modules/user/src/TempStore.php: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -65,11 +65,8 @@ class TempStore { * By default, data is stored for one week (604800 seconds) before expiring. * * @var int * * @todo Currently, this property is not exposed anywhere, and so the only * way to override it is by extending the class. */ protected $expire = 604800; protected $expire; /** * Constructs a new object for accessing data from a key/value store. Loading @@ -82,11 +79,14 @@ class TempStore { * The lock object used for this data. * @param mixed $owner * The owner key to store along with the data (e.g. a user or session ID). * @param int $expire * The time to live for items, in seconds. */ public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lockBackend, $owner) { public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lockBackend, $owner, $expire = 604800) { $this->storage = $storage; $this->lockBackend = $lockBackend; $this->owner = $owner; $this->expire = $expire; } /** Loading
core/modules/user/src/TempStoreFactory.php +12 −2 Changes for core/modules/user/src/TempStoreFactory.php: 12 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -38,6 +38,13 @@ class TempStoreFactory { */ protected $lockBackend; /** * The time to live for items in seconds. * * @var int */ protected $expire; /** * Constructs a Drupal\user\TempStoreFactory object. * Loading @@ -47,11 +54,14 @@ class TempStoreFactory { * The connection object used for this data. * @param \Drupal\Core\Lock\LockBackendInterface $lockBackend * The lock object used for this data. * @param int $expire * The time to live for items, in seconds. */ function __construct(SerializationInterface $serializer, Connection $connection, LockBackendInterface $lockBackend) { function __construct(SerializationInterface $serializer, Connection $connection, LockBackendInterface $lockBackend, $expire = 604800) { $this->serializer = $serializer; $this->connection = $connection; $this->lockBackend = $lockBackend; $this->expire = $expire; } /** Loading @@ -77,7 +87,7 @@ function get($collection, $owner = NULL) { // Store the data for this collection in the database. $storage = new DatabaseStorageExpirable($collection, $this->serializer, $this->connection); return new TempStore($storage, $this->lockBackend, $owner); return new TempStore($storage, $this->lockBackend, $owner, $this->expire); } }
core/modules/user/tests/src/TempStoreTest.php +1 −1 Changes for core/modules/user/tests/src/TempStoreTest.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -82,7 +82,7 @@ protected function setUp() { $this->keyValue = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface'); $this->lock = $this->getMock('Drupal\Core\Lock\LockBackendInterface'); $this->tempStore = new TempStore($this->keyValue, $this->lock, $this->owner); $this->tempStore = new TempStore($this->keyValue, $this->lock, $this->owner, 604800); $this->ownObject = (object) array( 'data' => 'test_data', Loading
core/modules/user/user.services.yml +4 −1 Changes for core/modules/user/user.services.yml: 4 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -54,4 +54,7 @@ services: arguments: ['@entity.manager', '@password'] user.tempstore: class: Drupal\user\TempStoreFactory arguments: ['@serialization.phpserialize', '@database', '@lock'] arguments: ['@serialization.phpserialize', '@database', '@lock', '%user.tempstore.expire%'] parameters: user.tempstore.expire: 604800