comparison core/modules/user/src/SharedTempStoreFactory.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php 1 <?php
2 2
3 namespace Drupal\user; 3 namespace Drupal\user;
4 4
5 use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface; 5 use Drupal\Core\TempStore\SharedTempStoreFactory as CoreSharedTempStoreFactory;
6 use Drupal\Core\Lock\LockBackendInterface; 6
7 use Symfony\Component\HttpFoundation\RequestStack; 7 @trigger_error('\Drupal\user\SharedTempStoreFactory is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStoreFactory instead. See https://www.drupal.org/node/2935639.', E_USER_DEPRECATED);
8 8
9 /** 9 /**
10 * Creates a shared temporary storage for a collection. 10 * Creates a shared temporary storage for a collection.
11 *
12 * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
13 * Use \Drupal\Core\TempStore\SharedTempStoreFactory instead.
14 *
15 * @see \Drupal\Core\TempStore\SharedTempStoreFactory
16 * @see https://www.drupal.org/node/2935639
11 */ 17 */
12 class SharedTempStoreFactory { 18 class SharedTempStoreFactory extends CoreSharedTempStoreFactory {
13
14 /**
15 * The storage factory creating the backend to store the data.
16 *
17 * @var \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface
18 */
19 protected $storageFactory;
20
21 /**
22 * The lock object used for this data.
23 *
24 * @var \Drupal\Core\Lock\LockBackendInterface
25 */
26 protected $lockBackend;
27
28 /**
29 * The request stack.
30 *
31 * @var \Symfony\Component\HttpFoundation\RequestStack
32 */
33 protected $requestStack;
34
35 /**
36 * The time to live for items in seconds.
37 *
38 * @var int
39 */
40 protected $expire;
41
42 /**
43 * Constructs a Drupal\user\SharedTempStoreFactory object.
44 *
45 * @param \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $storage_factory
46 * The key/value store factory.
47 * @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
48 * The lock object used for this data.
49 * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
50 * The request stack.
51 * @param int $expire
52 * The time to live for items, in seconds.
53 */
54 public function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, RequestStack $request_stack, $expire = 604800) {
55 $this->storageFactory = $storage_factory;
56 $this->lockBackend = $lock_backend;
57 $this->requestStack = $request_stack;
58 $this->expire = $expire;
59 }
60 19
61 /** 20 /**
62 * Creates a SharedTempStore for the current user or anonymous session. 21 * Creates a SharedTempStore for the current user or anonymous session.
63 * 22 *
64 * @param string $collection 23 * @param string $collection