summaryrefslogtreecommitdiffstats
path: root/core/modules
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules')
-rw-r--r--core/modules/comment/src/Form/CommentAdminOverview.php8
-rw-r--r--core/modules/comment/src/Form/ConfirmDeleteMultiple.php8
-rw-r--r--core/modules/comment/src/Plugin/Action/DeleteComment.php8
-rw-r--r--core/modules/image/src/Controller/QuickEditImageController.php8
-rw-r--r--core/modules/layout_builder/layout_builder.services.yml2
-rw-r--r--core/modules/layout_builder/src/LayoutTempstoreRepository.php8
-rw-r--r--core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php4
-rw-r--r--core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php8
-rw-r--r--core/modules/node/node.services.yml2
-rw-r--r--core/modules/node/src/Form/DeleteMultiple.php8
-rw-r--r--core/modules/node/src/NodeForm.php8
-rw-r--r--core/modules/node/src/ParamConverter/NodePreviewConverter.php6
-rw-r--r--core/modules/node/src/Plugin/Action/DeleteNode.php8
-rw-r--r--core/modules/quickedit/src/Form/QuickEditFieldForm.php8
-rw-r--r--core/modules/quickedit/src/QuickEditController.php8
-rw-r--r--core/modules/user/src/Form/UserMultipleCancelConfirm.php8
-rw-r--r--core/modules/user/src/Plugin/Action/CancelUser.php8
-rw-r--r--core/modules/user/src/PrivateTempStore.php217
-rw-r--r--core/modules/user/src/PrivateTempStoreFactory.php72
-rw-r--r--core/modules/user/src/SharedTempStore.php283
-rw-r--r--core/modules/user/src/SharedTempStoreFactory.php61
-rw-r--r--core/modules/user/src/TempStoreException.php11
-rw-r--r--core/modules/user/src/UserServiceProvider.php24
-rw-r--r--core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php6
-rw-r--r--core/modules/user/tests/src/Kernel/UserServiceProviderTest.php40
-rw-r--r--core/modules/user/tests/src/Unit/PrivateTempStoreTest.php10
-rw-r--r--core/modules/user/tests/src/Unit/SharedTempStoreTest.php15
-rw-r--r--core/modules/user/user.services.yml9
-rw-r--r--core/modules/views/src/Entity/View.php2
-rw-r--r--core/modules/views_ui/src/Form/BreakLockForm.php10
-rw-r--r--core/modules/views_ui/src/ParamConverter/ViewUIConverter.php6
-rw-r--r--core/modules/views_ui/src/ViewEditForm.php8
-rw-r--r--core/modules/views_ui/src/ViewUI.php6
-rw-r--r--core/modules/views_ui/tests/src/Functional/CachedDataUITest.php8
-rw-r--r--core/modules/views_ui/views_ui.services.yml2
35 files changed, 222 insertions, 686 deletions
diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php
index 1ffa2c6..4fe7291 100644
--- a/core/modules/comment/src/Form/CommentAdminOverview.php
+++ b/core/modules/comment/src/Form/CommentAdminOverview.php
@@ -9,7 +9,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -50,7 +50,7 @@ class CommentAdminOverview extends FormBase {
/**
* The tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -63,7 +63,7 @@ class CommentAdminOverview extends FormBase {
* The date formatter service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, DateFormatterInterface $date_formatter, ModuleHandlerInterface $module_handler, PrivateTempStoreFactory $temp_store_factory) {
@@ -82,7 +82,7 @@ class CommentAdminOverview extends FormBase {
$container->get('entity_type.manager'),
$container->get('date.formatter'),
$container->get('module_handler'),
- $container->get('user.private_tempstore')
+ $container->get('tempstore.private')
);
}
diff --git a/core/modules/comment/src/Form/ConfirmDeleteMultiple.php b/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
index 83f1889..7044393 100644
--- a/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
+++ b/core/modules/comment/src/Form/ConfirmDeleteMultiple.php
@@ -3,7 +3,7 @@
namespace Drupal\comment\Form;
use Drupal\comment\CommentStorageInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
@@ -19,7 +19,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
/**
* The tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -42,7 +42,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
*
* @param \Drupal\comment\CommentStorageInterface $comment_storage
* The comment storage.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
*/
public function __construct(CommentStorageInterface $comment_storage, PrivateTempStoreFactory $temp_store_factory) {
@@ -56,7 +56,7 @@ class ConfirmDeleteMultiple extends ConfirmFormBase {
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager')->getStorage('comment'),
- $container->get('user.private_tempstore')
+ $container->get('tempstore.private')
);
}
diff --git a/core/modules/comment/src/Plugin/Action/DeleteComment.php b/core/modules/comment/src/Plugin/Action/DeleteComment.php
index 675b021..5c6941d 100644
--- a/core/modules/comment/src/Plugin/Action/DeleteComment.php
+++ b/core/modules/comment/src/Plugin/Action/DeleteComment.php
@@ -5,7 +5,7 @@ namespace Drupal\comment\Plugin\Action;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -23,7 +23,7 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
/**
* The tempstore object.
*
- * @var \Drupal\user\PrivateTempStore
+ * @var \Drupal\Core\TempStore\PrivateTempStore
*/
protected $tempStore;
@@ -43,7 +43,7 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
* The plugin ID for the plugin instance.
* @param array $plugin_definition
* The plugin implementation definition.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
* @param \Drupal\Core\Session\AccountInterface $current_user
* The current user.
@@ -62,7 +62,7 @@ class DeleteComment extends ActionBase implements ContainerFactoryPluginInterfac
$configuration,
$plugin_id,
$plugin_definition,
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('current_user')
);
}
diff --git a/core/modules/image/src/Controller/QuickEditImageController.php b/core/modules/image/src/Controller/QuickEditImageController.php
index aa49bc7..5fc28ba 100644
--- a/core/modules/image/src/Controller/QuickEditImageController.php
+++ b/core/modules/image/src/Controller/QuickEditImageController.php
@@ -10,7 +10,7 @@ use Drupal\Core\Image\ImageFactory;
use Drupal\Core\Render\Element\StatusMessages;
use Drupal\Core\Render\RendererInterface;
use Drupal\image\Plugin\Field\FieldType\ImageItem;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -23,7 +23,7 @@ class QuickEditImageController extends ControllerBase {
/**
* Stores The Quick Edit tempstore.
*
- * @var \Drupal\user\PrivateTempStore
+ * @var \Drupal\Core\TempStore\PrivateTempStore
*/
protected $tempStore;
@@ -48,7 +48,7 @@ class QuickEditImageController extends ControllerBase {
* The renderer.
* @param \Drupal\Core\Image\ImageFactory $image_factory
* The image factory.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
*/
public function __construct(RendererInterface $renderer, ImageFactory $image_factory, PrivateTempStoreFactory $temp_store_factory) {
@@ -64,7 +64,7 @@ class QuickEditImageController extends ControllerBase {
return new static(
$container->get('renderer'),
$container->get('image.factory'),
- $container->get('user.private_tempstore')
+ $container->get('tempstore.private')
);
}
diff --git a/core/modules/layout_builder/layout_builder.services.yml b/core/modules/layout_builder/layout_builder.services.yml
index 67f1aa1..db6a1c1 100644
--- a/core/modules/layout_builder/layout_builder.services.yml
+++ b/core/modules/layout_builder/layout_builder.services.yml
@@ -1,7 +1,7 @@
services:
layout_builder.tempstore_repository:
class: Drupal\layout_builder\LayoutTempstoreRepository
- arguments: ['@user.shared_tempstore']
+ arguments: ['@tempstore.shared']
access_check.entity.layout:
class: Drupal\layout_builder\Access\LayoutSectionAccessCheck
tags:
diff --git a/core/modules/layout_builder/src/LayoutTempstoreRepository.php b/core/modules/layout_builder/src/LayoutTempstoreRepository.php
index 5e1a18d..0fa9d73 100644
--- a/core/modules/layout_builder/src/LayoutTempstoreRepository.php
+++ b/core/modules/layout_builder/src/LayoutTempstoreRepository.php
@@ -2,7 +2,7 @@
namespace Drupal\layout_builder;
-use Drupal\user\SharedTempStoreFactory;
+use Drupal\Core\TempStore\SharedTempStoreFactory;
/**
* Provides a mechanism for loading layouts from tempstore.
@@ -14,14 +14,14 @@ class LayoutTempstoreRepository implements LayoutTempstoreRepositoryInterface {
/**
* The shared tempstore factory.
*
- * @var \Drupal\user\SharedTempStoreFactory
+ * @var \Drupal\Core\TempStore\SharedTempStoreFactory
*/
protected $tempStoreFactory;
/**
* LayoutTempstoreRepository constructor.
*
- * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
* The shared tempstore factory.
*/
public function __construct(SharedTempStoreFactory $temp_store_factory) {
@@ -67,7 +67,7 @@ class LayoutTempstoreRepository implements LayoutTempstoreRepositoryInterface {
* @param \Drupal\layout_builder\SectionStorageInterface $section_storage
* The section storage.
*
- * @return \Drupal\user\SharedTempStore
+ * @return \Drupal\Core\TempStore\SharedTempStore
* The tempstore.
*/
protected function getTempstore(SectionStorageInterface $section_storage) {
diff --git a/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php b/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php
index 75502d5..b7702c1 100644
--- a/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php
+++ b/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php
@@ -5,8 +5,8 @@ namespace Drupal\Tests\layout_builder\Unit;
use Drupal\layout_builder\LayoutTempstoreRepository;
use Drupal\layout_builder\SectionStorageInterface;
use Drupal\Tests\UnitTestCase;
-use Drupal\user\SharedTempStore;
-use Drupal\user\SharedTempStoreFactory;
+use Drupal\Core\TempStore\SharedTempStore;
+use Drupal\Core\TempStore\SharedTempStoreFactory;
/**
* @coversDefaultClass \Drupal\layout_builder\LayoutTempstoreRepository
diff --git a/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php b/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php
index 616a567..6659887 100644
--- a/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php
+++ b/core/modules/media/src/Form/MediaDeleteMultipleConfirmForm.php
@@ -6,7 +6,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -27,7 +27,7 @@ class MediaDeleteMultipleConfirmForm extends ConfirmFormBase {
/**
* The tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -41,7 +41,7 @@ class MediaDeleteMultipleConfirmForm extends ConfirmFormBase {
/**
* Constructs a MediaDeleteMultipleConfirmForm form object.
*
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $manager
* The entity type manager.
@@ -56,7 +56,7 @@ class MediaDeleteMultipleConfirmForm extends ConfirmFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('entity_type.manager')
);
}
diff --git a/core/modules/node/node.services.yml b/core/modules/node/node.services.yml
index 2ff32c3..f94a4bb 100644
--- a/core/modules/node/node.services.yml
+++ b/core/modules/node/node.services.yml
@@ -30,7 +30,7 @@ services:
- { name: event_subscriber }
node_preview:
class: Drupal\node\ParamConverter\NodePreviewConverter
- arguments: ['@user.private_tempstore']
+ arguments: ['@tempstore.private']
tags:
- { name: paramconverter }
lazy: true
diff --git a/core/modules/node/src/Form/DeleteMultiple.php b/core/modules/node/src/Form/DeleteMultiple.php
index 8bc8f06..ef2c89f 100644
--- a/core/modules/node/src/Form/DeleteMultiple.php
+++ b/core/modules/node/src/Form/DeleteMultiple.php
@@ -6,7 +6,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -27,7 +27,7 @@ class DeleteMultiple extends ConfirmFormBase {
/**
* The tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -41,7 +41,7 @@ class DeleteMultiple extends ConfirmFormBase {
/**
* Constructs a DeleteMultiple form object.
*
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
* @param \Drupal\Core\Entity\EntityManagerInterface $manager
* The entity manager.
@@ -56,7 +56,7 @@ class DeleteMultiple extends ConfirmFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('entity.manager')
);
}
diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php
index 0513d1f..0ad34ad 100644
--- a/core/modules/node/src/NodeForm.php
+++ b/core/modules/node/src/NodeForm.php
@@ -8,7 +8,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -21,7 +21,7 @@ class NodeForm extends ContentEntityForm {
/**
* The tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -37,7 +37,7 @@ class NodeForm extends ContentEntityForm {
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The factory for the temp store object.
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
* The entity type bundle service.
@@ -58,7 +58,7 @@ class NodeForm extends ContentEntityForm {
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('entity_type.bundle.info'),
$container->get('datetime.time'),
$container->get('current_user')
diff --git a/core/modules/node/src/ParamConverter/NodePreviewConverter.php b/core/modules/node/src/ParamConverter/NodePreviewConverter.php
index b75d062..a40301a 100644
--- a/core/modules/node/src/ParamConverter/NodePreviewConverter.php
+++ b/core/modules/node/src/ParamConverter/NodePreviewConverter.php
@@ -2,7 +2,7 @@
namespace Drupal\node\ParamConverter;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\Routing\Route;
use Drupal\Core\ParamConverter\ParamConverterInterface;
@@ -14,14 +14,14 @@ class NodePreviewConverter implements ParamConverterInterface {
/**
* Stores the tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
/**
* Constructs a new NodePreviewConverter.
*
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The factory for the temp store object.
*/
public function __construct(PrivateTempStoreFactory $temp_store_factory) {
diff --git a/core/modules/node/src/Plugin/Action/DeleteNode.php b/core/modules/node/src/Plugin/Action/DeleteNode.php
index c4d1aeb..19f8a7a 100644
--- a/core/modules/node/src/Plugin/Action/DeleteNode.php
+++ b/core/modules/node/src/Plugin/Action/DeleteNode.php
@@ -5,7 +5,7 @@ namespace Drupal\node\Plugin\Action;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -23,7 +23,7 @@ class DeleteNode extends ActionBase implements ContainerFactoryPluginInterface {
/**
* The tempstore object.
*
- * @var \Drupal\user\SharedTempStore
+ * @var \Drupal\Core\TempStore\SharedTempStore
*/
protected $tempStore;
@@ -43,7 +43,7 @@ class DeleteNode extends ActionBase implements ContainerFactoryPluginInterface {
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
* @param \Drupal\Core\Session\AccountInterface $current_user
* Current user.
@@ -63,7 +63,7 @@ class DeleteNode extends ActionBase implements ContainerFactoryPluginInterface {
$configuration,
$plugin_id,
$plugin_definition,
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('current_user')
);
}
diff --git a/core/modules/quickedit/src/Form/QuickEditFieldForm.php b/core/modules/quickedit/src/Form/QuickEditFieldForm.php
index a9e0671..c092167 100644
--- a/core/modules/quickedit/src/Form/QuickEditFieldForm.php
+++ b/core/modules/quickedit/src/Form/QuickEditFieldForm.php
@@ -10,7 +10,7 @@ use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
@@ -24,7 +24,7 @@ class QuickEditFieldForm extends FormBase {
/**
* Stores the tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -52,7 +52,7 @@ class QuickEditFieldForm extends FormBase {
/**
* Constructs a new EditFieldForm.
*
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
@@ -73,7 +73,7 @@ class QuickEditFieldForm extends FormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('module_handler'),
$container->get('entity.manager')->getStorage('node_type'),
$container->get('typed_data_manager')->getValidator()
diff --git a/core/modules/quickedit/src/QuickEditController.php b/core/modules/quickedit/src/QuickEditController.php
index 2b1e4b2..0f470b1 100644
--- a/core/modules/quickedit/src/QuickEditController.php
+++ b/core/modules/quickedit/src/QuickEditController.php
@@ -5,7 +5,7 @@ namespace Drupal\quickedit;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Form\FormState;
use Drupal\Core\Render\RendererInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -25,7 +25,7 @@ class QuickEditController extends ControllerBase {
/**
* The PrivateTempStore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -53,7 +53,7 @@ class QuickEditController extends ControllerBase {
/**
* Constructs a new QuickEditController.
*
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The PrivateTempStore factory.
* @param \Drupal\quickedit\MetadataGeneratorInterface $metadata_generator
* The in-place editing metadata generator.
@@ -74,7 +74,7 @@ class QuickEditController extends ControllerBase {
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('quickedit.metadata.generator'),
$container->get('quickedit.editor.selector'),
$container->get('renderer')
diff --git a/core/modules/user/src/Form/UserMultipleCancelConfirm.php b/core/modules/user/src/Form/UserMultipleCancelConfirm.php
index 985d199..b4487c2 100644
--- a/core/modules/user/src/Form/UserMultipleCancelConfirm.php
+++ b/core/modules/user/src/Form/UserMultipleCancelConfirm.php
@@ -6,7 +6,7 @@ use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Drupal\user\UserStorageInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -20,7 +20,7 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
/**
* The temp store factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -41,7 +41,7 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
/**
* Constructs a new UserMultipleCancelConfirm.
*
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The temp store factory.
* @param \Drupal\user\UserStorageInterface $user_storage
* The user storage.
@@ -59,7 +59,7 @@ class UserMultipleCancelConfirm extends ConfirmFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('entity.manager')->getStorage('user'),
$container->get('entity.manager')
);
diff --git a/core/modules/user/src/Plugin/Action/CancelUser.php b/core/modules/user/src/Plugin/Action/CancelUser.php
index 60ae156..e9726b4 100644
--- a/core/modules/user/src/Plugin/Action/CancelUser.php
+++ b/core/modules/user/src/Plugin/Action/CancelUser.php
@@ -5,7 +5,7 @@ namespace Drupal\user\Plugin\Action;
use Drupal\Core\Action\ActionBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Session\AccountInterface;
-use Drupal\user\PrivateTempStoreFactory;
+use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -23,7 +23,7 @@ class CancelUser extends ActionBase implements ContainerFactoryPluginInterface {
/**
* The tempstore factory.
*
- * @var \Drupal\user\PrivateTempStoreFactory
+ * @var \Drupal\Core\TempStore\PrivateTempStoreFactory
*/
protected $tempStoreFactory;
@@ -43,7 +43,7 @@ class CancelUser extends ActionBase implements ContainerFactoryPluginInterface {
* The plugin ID for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
- * @param \Drupal\user\PrivateTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $temp_store_factory
* The tempstore factory.
* @param \Drupal\Core\Session\AccountInterface $current_user
* Current user.
@@ -63,7 +63,7 @@ class CancelUser extends ActionBase implements ContainerFactoryPluginInterface {
$configuration,
$plugin_id,
$plugin_definition,
- $container->get('user.private_tempstore'),
+ $container->get('tempstore.private'),
$container->get('current_user')
);
}
diff --git a/core/modules/user/src/PrivateTempStore.php b/core/modules/user/src/PrivateTempStore.php
index 786ff1e..8b0bc43 100644
--- a/core/modules/user/src/PrivateTempStore.php
+++ b/core/modules/user/src/PrivateTempStore.php
@@ -2,212 +2,25 @@
namespace Drupal\user;
-use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
-use Drupal\Core\Lock\LockBackendInterface;
-use Drupal\Core\Session\AccountProxyInterface;
-use Symfony\Component\HttpFoundation\RequestStack;
+use Drupal\Core\TempStore\PrivateTempStore as CorePrivateTempStore;
+
+@trigger_error('\Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.', E_USER_DEPRECATED);
+
+/**
+ * In order to preserve BC alias the core exception.
+ */
+if (!class_exists('\Drupal\user\TempStoreException')) {
+ class_alias('\Drupal\Core\TempStore\TempStoreException', '\Drupal\user\TempStoreException');
+}
/**
* Stores and retrieves temporary data for a given owner.
*
- * A PrivateTempStore can be used to make temporary, non-cache data available
- * across requests. The data for the PrivateTempStore is stored in one
- * key/value collection. PrivateTempStore data expires automatically after a
- * given timeframe.
+ * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
+ * Use \Drupal\Core\TempStore\PrivateTempStore instead.
*
- * The PrivateTempStore is different from a cache, because the data in it is not
- * yet saved permanently and so it cannot be rebuilt. Typically, the
- * PrivateTempStore might be used to store work in progress that is later saved
- * permanently elsewhere, e.g. autosave data, multistep forms, or in-progress
- * changes to complex configuration that are not ready to be saved.
- *
- * The PrivateTempStore differs from the SharedTempStore in that all keys are
- * ensured to be unique for a particular user and users can never share data. If
- * you want to be able to share data between users or use it for locking, use
- * \Drupal\user\SharedTempStore.
+ * @see \Drupal\Core\TempStore\PrivateTempStore
+ * @see https://www.drupal.org/node/2935639
*/
-class PrivateTempStore {
-
- /**
- * The key/value storage object used for this data.
- *
- * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
- */
- protected $storage;
-
- /**
- * The lock object used for this data.
- *
- * @var \Drupal\Core\Lock\LockBackendInterface
- */
- protected $lockBackend;
-
- /**
- * The current user.
- *
- * @var \Drupal\Core\Session\AccountProxyInterface
- */
- protected $currentUser;
-
- /**
- * The request stack.
- *
- * @var \Symfony\Component\HttpFoundation\RequestStack
- */
- protected $requestStack;
-
- /**
- * The time to live for items in seconds.
- *
- * By default, data is stored for one week (604800 seconds) before expiring.
- *
- * @var int
- */
- protected $expire;
-
- /**
- * Constructs a new object for accessing data from a key/value store.
- *
- * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $storage
- * The key/value storage object used for this data. Each storage object
- * represents a particular collection of data and will contain any number
- * of key/value pairs.
- * @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
- * The lock object used for this data.
- * @param \Drupal\Core\Session\AccountProxyInterface $current_user
- * The current user account.
- * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
- * The request stack.
- * @param int $expire
- * The time to live for items, in seconds.
- */
- public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
- $this->storage = $storage;
- $this->lockBackend = $lock_backend;
- $this->currentUser = $current_user;
- $this->requestStack = $request_stack;
- $this->expire = $expire;
- }
-
- /**
- * Retrieves a value from this PrivateTempStore for a given key.
- *
- * @param string $key
- * The key of the data to retrieve.
- *
- * @return mixed
- * The data associated with the key, or NULL if the key does not exist.
- */
- public function get($key) {
- $key = $this->createkey($key);
- if (($object = $this->storage->get($key)) && ($object->owner == $this->getOwner())) {
- return $object->data;
- }
- }
-
- /**
- * Stores a particular key/value pair in this PrivateTempStore.
- *
- * @param string $key
- * The key of the data to store.
- * @param mixed $value
- * The data to store.
- *
- * @throws \Drupal\user\TempStoreException
- * Thrown when a lock for the backend storage could not be acquired.
- */
- public function set($key, $value) {
- $key = $this->createkey($key);
- if (!$this->lockBackend->acquire($key)) {
- $this->lockBackend->wait($key);
- if (!$this->lockBackend->acquire($key)) {
- throw new TempStoreException("Couldn't acquire lock to update item '$key' in '{$this->storage->getCollectionName()}' temporary storage.");
- }
- }
-
- $value = (object) [
- 'owner' => $this->getOwner(),
- 'data' => $value,
- 'updated' => (int) $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'),
- ];
- $this->storage->setWithExpire($key, $value, $this->expire);
- $this->lockBackend->release($key);
- }
-
- /**
- * Returns the metadata associated with a particular key/value pair.
- *
- * @param string $key
- * The key of the data to store.
- *
- * @return mixed
- * An object with the owner and updated time if the key has a value, or
- * NULL otherwise.
- */
- public function getMetadata($key) {
- $key = $this->createkey($key);
- // Fetch the key/value pair and its metadata.
- $object = $this->storage->get($key);
- if ($object) {
- // Don't keep the data itself in memory.
- unset($object->data);
- return $object;
- }
- }
-
- /**
- * Deletes data from the store for a given key and releases the lock on it.
- *
- * @param string $key
- * The key of the data to delete.
- *
- * @return bool
- * TRUE if the object was deleted or does not exist, FALSE if it exists but
- * is not owned by $this->owner.
- *
- * @throws \Drupal\user\TempStoreException
- * Thrown when a lock for the backend storage could not be acquired.
- */
- public function delete($key) {
- $key = $this->createkey($key);
- if (!$object = $this->storage->get($key)) {
- return TRUE;
- }
- elseif ($object->owner != $this->getOwner()) {
- return FALSE;
- }
- if (!$this->lockBackend->acquire($key)) {
- $this->lockBackend->wait($key);
- if (!$this->lockBackend->acquire($key)) {
- throw new TempStoreException("Couldn't acquire lock to delete item '$key' from '{$this->storage->getCollectionName()}' temporary storage.");
- }
- }
- $this->storage->delete($key);
- $this->lockBackend->release($key);
- return TRUE;
- }
-
- /**
- * Ensures that the key is unique for a user.
- *
- * @param string $key
- * The key.
- *
- * @return string
- * The unique key for the user.
- */
- protected function createkey($key) {
- return $this->getOwner() . ':' . $key;
- }
-
- /**
- * Gets the current owner based on the current user or the session ID.
- *
- * @return string
- * The owner.
- */
- protected function getOwner() {
- return $this->currentUser->id() ?: $this->requestStack->getCurrentRequest()->getSession()->getId();
- }
-
+class PrivateTempStore extends CorePrivateTempStore {
}
diff --git a/core/modules/user/src/PrivateTempStoreFactory.php b/core/modules/user/src/PrivateTempStoreFactory.php
index e51faf3..21d6bd1 100644
--- a/core/modules/user/src/PrivateTempStoreFactory.php
+++ b/core/modules/user/src/PrivateTempStoreFactory.php
@@ -2,72 +2,20 @@
namespace Drupal\user;
-use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface;
-use Drupal\Core\Lock\LockBackendInterface;
-use Drupal\Core\Session\AccountProxyInterface;
-use Symfony\Component\HttpFoundation\RequestStack;
+use Drupal\Core\TempStore\PrivateTempStoreFactory as CorePrivateTempStoreFactory;
+
+@trigger_error('\Drupal\user\PrivateTempStoreFactory is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead. See https://www.drupal.org/node/2935639.', E_USER_DEPRECATED);
/**
* Creates a PrivateTempStore object for a given collection.
+ *
+ * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
+ * Use \Drupal\Core\TempStore\PrivateTempStoreFactory instead.
+ *
+ * @see \Drupal\Core\TempStore\PrivateTempStoreFactory
+ * @see https://www.drupal.org/node/2935639
*/
-class PrivateTempStoreFactory {
-
- /**
- * The storage factory creating the backend to store the data.
- *
- * @var \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface
- */
- protected $storageFactory;
-
- /**
- * The lock object used for this data.
- *
- * @var \Drupal\Core\Lock\LockBackendInterface
- */
- protected $lockBackend;
-
- /**
- * The current user.
- *
- * @var \Drupal\Core\Session\AccountProxyInterface
- */
- protected $currentUser;
-
- /**
- * The request stack.
- *
- * @var \Symfony\Component\HttpFoundation\RequestStack
- */
- protected $requestStack;
-
- /**
- * The time to live for items in seconds.
- *
- * @var int
- */
- protected $expire;
-
- /**
- * Constructs a Drupal\user\PrivateTempStoreFactory object.
- *
- * @param \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $storage_factory
- * The key/value store factory.
- * @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
- * The lock object used for this data.
- * @param \Drupal\Core\Session\AccountProxyInterface $current_user
- * The current account.
- * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
- * The request stack.
- * @param int $expire
- * The time to live for items, in seconds.
- */
- public function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, AccountProxyInterface $current_user, RequestStack $request_stack, $expire = 604800) {
- $this->storageFactory = $storage_factory;
- $this->lockBackend = $lock_backend;
- $this->currentUser = $current_user;
- $this->requestStack = $request_stack;
- $this->expire = $expire;
- }
+class PrivateTempStoreFactory extends CorePrivateTempStoreFactory {
/**
* Creates a PrivateTempStore.
diff --git a/core/modules/user/src/SharedTempStore.php b/core/modules/user/src/SharedTempStore.php
index 91a622b..1802110 100644
--- a/core/modules/user/src/SharedTempStore.php
+++ b/core/modules/user/src/SharedTempStore.php
@@ -2,278 +2,25 @@
namespace Drupal\user;
-use Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface;
-use Drupal\Core\Lock\LockBackendInterface;
-use Symfony\Component\HttpFoundation\RequestStack;
+use Drupal\Core\TempStore\SharedTempStore as CoreSharedTempStore;
+
+@trigger_error('\Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.', E_USER_DEPRECATED);
+
+/**
+ * In order to preserve BC alias the core exception.
+ */
+if (!class_exists('\Drupal\user\TempStoreException')) {
+ class_alias('\Drupal\Core\TempStore\TempStoreException', '\Drupal\user\TempStoreException');
+}
/**
* Stores and retrieves temporary data for a given owner.
*
- * A SharedTempStore can be used to make temporary, non-cache data available
- * across requests. The data for the SharedTempStore is stored in one key/value
- * collection. SharedTempStore data expires automatically after a given
- * timeframe.
- *
- * The SharedTempStore is different from a cache, because the data in it is not
- * yet saved permanently and so it cannot be rebuilt. Typically, the
- * SharedTempStore might be used to store work in progress that is later saved
- * permanently elsewhere, e.g. autosave data, multistep forms, or in-progress
- * changes to complex configuration that are not ready to be saved.
- *
- * Each SharedTempStore belongs to a particular owner (e.g. a user, session, or
- * process). Multiple owners may use the same key/value collection, and the
- * owner is stored along with the key/value pair.
+ * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
+ * Use \Drupal\Core\TempStore\SharedTempStore instead.
*
- * Every key is unique within the collection, so the SharedTempStore can check
- * whether a particular key is already set by a different owner. This is
- * useful for informing one owner that the data is already in use by another;
- * for example, to let one user know that another user is in the process of
- * editing certain data, or even to restrict other users from editing it at
- * the same time. It is the responsibility of the implementation to decide
- * when and whether one owner can use or update another owner's data.
- *
- * If you want to be able to ensure that the data belongs to the current user,
- * use \Drupal\user\PrivateTempStore.
+ * @see \Drupal\Core\TempStore\SharedTempStore
+ * @see https://www.drupal.org/node/2935639
*/
-class SharedTempStore {
-
- /**
- * The key/value storage object used for this data.
- *
- * @var \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface
- */
- protected $storage;
-
- /**
- * The lock object used for this data.
- *
- * @var \Drupal\Core\Lock\LockBackendInterface
- */
- protected $lockBackend;
-
- /**
- * The request stack.
- *
- * @var \Symfony\Component\HttpFoundation\RequestStack
- */
- protected $requestStack;
-
- /**
- * The owner key to store along with the data (e.g. a user or session ID).
- *
- * @var mixed
- */
- protected $owner;
-
- /**
- * The time to live for items in seconds.
- *
- * By default, data is stored for one week (604800 seconds) before expiring.
- *
- * @var int
- */
- protected $expire;
-
- /**
- * Constructs a new object for accessing data from a key/value store.
- *
- * @param \Drupal\Core\KeyValueStore\KeyValueStoreExpirableInterface $storage
- * The key/value storage object used for this data. Each storage object
- * represents a particular collection of data and will contain any number
- * of key/value pairs.
- * @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
- * 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 \Symfony\Component\HttpFoundation\RequestStack $request_stack
- * The request stack.
- * @param int $expire
- * The time to live for items, in seconds.
- */
- public function __construct(KeyValueStoreExpirableInterface $storage, LockBackendInterface $lock_backend, $owner, RequestStack $request_stack, $expire = 604800) {
- $this->storage = $storage;
- $this->lockBackend = $lock_backend;
- $this->owner = $owner;
- $this->requestStack = $request_stack;
- $this->expire = $expire;
- }
-
- /**
- * Retrieves a value from this SharedTempStore for a given key.
- *
- * @param string $key
- * The key of the data to retrieve.
- *
- * @return mixed
- * The data associated with the key, or NULL if the key does not exist.
- */
- public function get($key) {
- if ($object = $this->storage->get($key)) {
- return $object->data;
- }
- }
-
- /**
- * Retrieves a value from this SharedTempStore for a given key.
- *
- * Only returns the value if the value is owned by $this->owner.
- *
- * @param string $key
- * The key of the data to retrieve.
- *
- * @return mixed
- * The data associated with the key, or NULL if the key does not exist.
- */
- public function getIfOwner($key) {
- if (($object = $this->storage->get($key)) && ($object->owner == $this->owner)) {
- return $object->data;
- }
- }
-
- /**
- * Stores a particular key/value pair only if the key doesn't already exist.
- *
- * @param string $key
- * The key of the data to check and store.
- * @param mixed $value
- * The data to store.
- *
- * @return bool
- * TRUE if the data was set, or FALSE if it already existed.
- */
- public function setIfNotExists($key, $value) {
- $value = (object) [
- 'owner' => $this->owner,
- 'data' => $value,
- 'updated' => (int) $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'),
- ];
- return $this->storage->setWithExpireIfNotExists($key, $value, $this->expire);
- }
-
- /**
- * Stores a particular key/value pair in this SharedTempStore.
- *
- * Only stores the given key/value pair if it does not exist yet or is owned
- * by $this->owner.
- *
- * @param string $key
- * The key of the data to store.
- * @param mixed $value
- * The data to store.
- *
- * @return bool
- * TRUE if the data was set, or FALSE if it already exists and is not owned
- * by $this->user.
- *
- * @throws \Drupal\user\TempStoreException
- * Thrown when a lock for the backend storage could not be acquired.
- */
- public function setIfOwner($key, $value) {
- if ($this->setIfNotExists($key, $value)) {
- return TRUE;
- }
-
- if (($object = $this->storage->get($key)) && ($object->owner == $this->owner)) {
- $this->set($key, $value);
- return TRUE;
- }
-
- return FALSE;
- }
-
- /**
- * Stores a particular key/value pair in this SharedTempStore.
- *
- * @param string $key
- * The key of the data to store.
- * @param mixed $value
- * The data to store.
- *
- * @throws \Drupal\user\TempStoreException
- * Thrown when a lock for the backend storage could not be acquired.
- */
- public function set($key, $value) {
- if (!$this->lockBackend->acquire($key)) {
- $this->lockBackend->wait($key);
- if (!$this->lockBackend->acquire($key)) {
- throw new TempStoreException("Couldn't acquire lock to update item '$key' in '{$this->storage->getCollectionName()}' temporary storage.");
- }
- }
-
- $value = (object) [
- 'owner' => $this->owner,
- 'data' => $value,
- 'updated' => (int) $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'),
- ];
- $this->storage->setWithExpire($key, $value, $this->expire);
- $this->lockBackend->release($key);
- }
-
- /**
- * Returns the metadata associated with a particular key/value pair.
- *
- * @param string $key
- * The key of the data to store.
- *
- * @return mixed
- * An object with the owner and updated time if the key has a value, or
- * NULL otherwise.
- */
- public function getMetadata($key) {
- // Fetch the key/value pair and its metadata.
- $object = $this->storage->get($key);
- if ($object) {
- // Don't keep the data itself in memory.
- unset($object->data);
- return $object;
- }
- }
-
- /**
- * Deletes data from the store for a given key and releases the lock on it.
- *
- * @param string $key
- * The key of the data to delete.
- *
- * @throws \Drupal\user\TempStoreException
- * Thrown when a lock for the backend storage could not be acquired.
- */
- public function delete($key) {
- if (!$this->lockBackend->acquire($key)) {
- $this->lockBackend->wait($key);
- if (!$this->lockBackend->acquire($key)) {
- throw new TempStoreException("Couldn't acquire lock to delete item '$key' from {$this->storage->getCollectionName()} temporary storage.");
- }
- }
- $this->storage->delete($key);
- $this->lockBackend->release($key);
- }
-
- /**
- * Deletes data from the store for a given key and releases the lock on it.
- *
- * Only delete the given key if it is owned by $this->owner.
- *
- * @param string $key
- * The key of the data to delete.
- *
- * @return bool
- * TRUE if the object was deleted or does not exist, FALSE if it exists but
- * is not owned by $this->owner.
- *
- * @throws \Drupal\user\TempStoreException
- * Thrown when a lock for the backend storage could not be acquired.
- */
- public function deleteIfOwner($key) {
- if (!$object = $this->storage->get($key)) {
- return TRUE;
- }
- elseif ($object->owner == $this->owner) {
- $this->delete($key);
- return TRUE;
- }
-
- return FALSE;
- }
-
+class SharedTempStore extends CoreSharedTempStore {
}
diff --git a/core/modules/user/src/SharedTempStoreFactory.php b/core/modules/user/src/SharedTempStoreFactory.php
index 29f8683..c955f07 100644
--- a/core/modules/user/src/SharedTempStoreFactory.php
+++ b/core/modules/user/src/SharedTempStoreFactory.php
@@ -2,61 +2,20 @@
namespace Drupal\user;
-use Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface;
-use Drupal\Core\Lock\LockBackendInterface;
-use Symfony\Component\HttpFoundation\RequestStack;
+use Drupal\Core\TempStore\SharedTempStoreFactory as CoreSharedTempStoreFactory;
+
+@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);
/**
* Creates a shared temporary storage for a collection.
+ *
+ * @deprecated in Drupal 8.5.x, to be removed before Drupal 9.0.0.
+ * Use \Drupal\Core\TempStore\SharedTempStoreFactory instead.
+ *
+ * @see \Drupal\Core\TempStore\SharedTempStoreFactory
+ * @see https://www.drupal.org/node/2935639
*/
-class SharedTempStoreFactory {
-
- /**
- * The storage factory creating the backend to store the data.
- *
- * @var \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface
- */
- protected $storageFactory;
-
- /**
- * The lock object used for this data.
- *
- * @var \Drupal\Core\Lock\LockBackendInterface
- */
- protected $lockBackend;
-
- /**
- * The request stack.
- *
- * @var \Symfony\Component\HttpFoundation\RequestStack
- */
- protected $requestStack;
-
- /**
- * The time to live for items in seconds.
- *
- * @var int
- */
- protected $expire;
-
- /**
- * Constructs a Drupal\user\SharedTempStoreFactory object.
- *
- * @param \Drupal\Core\KeyValueStore\KeyValueExpirableFactoryInterface $storage_factory
- * The key/value store factory.
- * @param \Drupal\Core\Lock\LockBackendInterface $lock_backend
- * The lock object used for this data.
- * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
- * The request stack.
- * @param int $expire
- * The time to live for items, in seconds.
- */
- public function __construct(KeyValueExpirableFactoryInterface $storage_factory, LockBackendInterface $lock_backend, RequestStack $request_stack, $expire = 604800) {
- $this->storageFactory = $storage_factory;
- $this->lockBackend = $lock_backend;
- $this->requestStack = $request_stack;
- $this->expire = $expire;
- }
+class SharedTempStoreFactory extends CoreSharedTempStoreFactory {
/**
* Creates a SharedTempStore for the current user or anonymous session.
diff --git a/core/modules/user/src/TempStoreException.php b/core/modules/user/src/TempStoreException.php
deleted file mode 100644
index 1f9c79b..0000000
--- a/core/modules/user/src/TempStoreException.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-
-namespace Drupal\user;
-
-/**
- * Thrown by SharedTempStore and PrivateTempStore if they cannot acquire a lock.
- *
- * @see \Drupal\user\SharedTempStore
- * @see \Drupal\user\PrivateTempStore
- */
-class TempStoreException extends \Exception {}
diff --git a/core/modules/user/src/UserServiceProvider.php b/core/modules/user/src/UserServiceProvider.php
index 49537e5..d43604c 100644
--- a/core/modules/user/src/UserServiceProvider.php
+++ b/core/modules/user/src/UserServiceProvider.php
@@ -1,8 +1,20 @@
<?php
-// @codingStandardsIgnoreFile
-// This class is intentionally empty so that it overwrites when sites are
-// updated from a zip/tarball without deleting the /core folder first.
-// @todo: remove in 8.3.x
-//
+
namespace Drupal\user;
-class UserServiceProvider {}
+
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\DependencyInjection\ServiceModifierInterface;
+
+class UserServiceProvider implements ServiceModifierInterface {
+
+ /**
+ * {@inheritdoc}
+ */
+ public function alter(ContainerBuilder $container) {
+ if ($container->hasParameter('user.tempstore.expire')) {
+ @trigger_error('The container parameter "user.tempstore.expire" is deprecated. Use "tempstore.expire" instead. See https://www.drupal.org/node/2935639.', E_USER_DEPRECATED);
+ $container->setParameter('tempstore.expire', $container->getParameter('user.tempstore.expire'));
+ }
+ }
+
+}
diff --git a/core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php b/core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php
index b3d7ff1..ae9d4cb 100644
--- a/core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php
+++ b/core/modules/user/tests/src/Kernel/TempStoreDatabaseTest.php
@@ -12,7 +12,8 @@ use Drupal\Core\Database\Database;
* Tests the temporary object storage system.
*
* @group user
- * @see \Drupal\Core\TempStore\TempStore.
+ * @group legacy
+ * @see \Drupal\user\SharedTempStore
*/
class TempStoreDatabaseTest extends KernelTestBase {
@@ -67,6 +68,9 @@ class TempStoreDatabaseTest extends KernelTestBase {
/**
* Tests the UserTempStore API.
+ *
+ * @expectedDeprecation \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.
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testUserTempStore() {
// Create a key/value collection.
diff --git a/core/modules/user/tests/src/Kernel/UserServiceProviderTest.php b/core/modules/user/tests/src/Kernel/UserServiceProviderTest.php
new file mode 100644
index 0000000..38f1af1
--- /dev/null
+++ b/core/modules/user/tests/src/Kernel/UserServiceProviderTest.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Drupal\Tests\user\Kernel;
+
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\KernelTests\KernelTestBase;
+
+/**
+ * Tests \Drupal\user\UserServiceProvider.
+ *
+ * @group user
+ * @group legacy
+ */
+class UserServiceProviderTest extends KernelTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = ['user'];
+
+ /**
+ * Tests that tempstore.expire is set to user.tempstore.expire.
+ *
+ * @expectedDeprecation The container parameter "user.tempstore.expire" is deprecated. Use "tempstore.expire" instead. See https://www.drupal.org/node/2935639.
+ */
+ public function testUserServiceProvider() {
+ $this->assertEquals(1000, $this->container->getParameter('tempstore.expire'));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function register(ContainerBuilder $container) {
+ $container->setParameter('user.tempstore.expire', 1000);
+ parent::register($container);
+ }
+
+}
diff --git a/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php b/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
index 8d18811..be9376a 100644
--- a/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/PrivateTempStoreTest.php
@@ -11,6 +11,9 @@ use Symfony\Component\HttpFoundation\RequestStack;
/**
* @coversDefaultClass \Drupal\user\PrivateTempStore
* @group user
+ * @group legacy
+ * @runTestsInSeparateProcesses
+ * @preserveGlobalState disabled
*/
class PrivateTempStoreTest extends UnitTestCase {
@@ -98,6 +101,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests the get() method.
*
* @covers ::get
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testGet() {
$this->keyValue->expects($this->at(0))
@@ -122,6 +126,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests the set() method with no lock available.
*
* @covers ::set
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSetWithNoLockAvailable() {
$this->lock->expects($this->at(0))
@@ -147,6 +152,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests a successful set() call.
*
* @covers ::set
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSet() {
$this->lock->expects($this->once())
@@ -170,6 +176,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests the getMetadata() method.
*
* @covers ::getMetadata
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testGetMetadata() {
$this->keyValue->expects($this->at(0))
@@ -194,6 +201,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests the locking in the delete() method.
*
* @covers ::delete
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testDeleteLocking() {
$this->keyValue->expects($this->once())
@@ -221,6 +229,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests the delete() method with no lock available.
*
* @covers ::delete
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testDeleteWithNoLockAvailable() {
$this->keyValue->expects($this->once())
@@ -250,6 +259,7 @@ class PrivateTempStoreTest extends UnitTestCase {
* Tests the delete() method.
*
* @covers ::delete
+ * @expectedDeprecation \Drupal\user\PrivateTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\PrivateTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testDelete() {
$this->lock->expects($this->once())
diff --git a/core/modules/user/tests/src/Unit/SharedTempStoreTest.php b/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
index 33bde41..6b5d441 100644
--- a/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
+++ b/core/modules/user/tests/src/Unit/SharedTempStoreTest.php
@@ -11,6 +11,9 @@ use Symfony\Component\HttpFoundation\RequestStack;
/**
* @coversDefaultClass \Drupal\user\SharedTempStore
* @group user
+ * @group legacy
+ * @runTestsInSeparateProcesses
+ * @preserveGlobalState disabled
*/
class SharedTempStoreTest extends UnitTestCase {
@@ -90,6 +93,7 @@ class SharedTempStoreTest extends UnitTestCase {
/**
* @covers ::get
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testGet() {
$this->keyValue->expects($this->at(0))
@@ -109,6 +113,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the getIfOwner() method.
*
* @covers ::getIfOwner
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testGetIfOwner() {
$this->keyValue->expects($this->at(0))
@@ -133,6 +138,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the set() method with no lock available.
*
* @covers ::set
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSetWithNoLockAvailable() {
$this->lock->expects($this->at(0))
@@ -158,6 +164,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests a successful set() call.
*
* @covers ::set
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSet() {
$this->lock->expects($this->once())
@@ -181,6 +188,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the setIfNotExists() methods.
*
* @covers ::setIfNotExists
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSetIfNotExists() {
$this->keyValue->expects($this->once())
@@ -195,6 +203,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the setIfOwner() method when no key exists.
*
* @covers ::setIfOwner
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSetIfOwnerWhenNotExists() {
$this->keyValue->expects($this->once())
@@ -208,6 +217,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the setIfOwner() method when a key already exists but no object.
*
* @covers ::setIfOwner
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSetIfOwnerNoObject() {
$this->keyValue->expects($this->once())
@@ -226,6 +236,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the setIfOwner() method with matching and non matching owners.
*
* @covers ::setIfOwner
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testSetIfOwner() {
$this->lock->expects($this->once())
@@ -250,6 +261,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the getMetadata() method.
*
* @covers ::getMetadata
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testGetMetadata() {
$this->keyValue->expects($this->at(0))
@@ -274,6 +286,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the delete() method.
*
* @covers ::delete
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testDelete() {
$this->lock->expects($this->once())
@@ -297,6 +310,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the delete() method with no lock available.
*
* @covers ::delete
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testDeleteWithNoLockAvailable() {
$this->lock->expects($this->at(0))
@@ -322,6 +336,7 @@ class SharedTempStoreTest extends UnitTestCase {
* Tests the deleteIfOwner() method.
*
* @covers ::deleteIfOwner
+ * @expectedDeprecation \Drupal\user\SharedTempStore is scheduled for removal in Drupal 9.0.0. Use \Drupal\Core\TempStore\SharedTempStore instead. See https://www.drupal.org/node/2935639.
*/
public function testDeleteIfOwner() {
$this->lock->expects($this->once())
diff --git a/core/modules/user/user.services.yml b/core/modules/user/user.services.yml
index c273cb3..aede2f4 100644
--- a/core/modules/user/user.services.yml
+++ b/core/modules/user/user.services.yml
@@ -50,12 +50,14 @@ services:
arguments: ['@entity.manager', '@password']
user.private_tempstore:
class: Drupal\user\PrivateTempStoreFactory
- arguments: ['@keyvalue.expirable', '@lock', '@current_user', '@request_stack', '%user.tempstore.expire%']
+ arguments: ['@keyvalue.expirable', '@lock', '@current_user', '@request_stack', '%tempstore.expire%']
+ deprecated: The "%service_id%" service is deprecated. You should use the 'tempstore.private' service instead. See https://www.drupal.org/node/2935639.
tags:
- { name: backend_overridable }
user.shared_tempstore:
class: Drupal\user\SharedTempStoreFactory
- arguments: ['@keyvalue.expirable', '@lock', '@request_stack', '%user.tempstore.expire%']
+ arguments: ['@keyvalue.expirable', '@lock', '@request_stack', '%tempstore.expire%']
+ deprecated: The "%service_id%" service is deprecated. You should use the 'tempstore.shared' service instead. See https://www.drupal.org/node/2935639.
tags:
- { name: backend_overridable }
user.permissions:
@@ -66,6 +68,3 @@ services:
arguments: ['@current_user', '@entity.manager']
tags:
- { name: 'context_provider' }
-
-parameters:
- user.tempstore.expire: 604800
diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php
index b69234c..c82d64c 100644
--- a/core/modules/views/src/Entity/View.php
+++ b/core/modules/views/src/Entity/View.php
@@ -456,7 +456,7 @@ class View extends ConfigEntityBase implements ViewEntityInterface {
public static function postDelete(EntityStorageInterface $storage, array $entities) {
parent::postDelete($storage, $entities);
- $tempstore = \Drupal::service('user.shared_tempstore')->get('views');
+ $tempstore = \Drupal::service('tempstore.shared')->get('views');
foreach ($entities as $entity) {
$tempstore->delete($entity->id());
}
diff --git a/core/modules/views_ui/src/Form/BreakLockForm.php b/core/modules/views_ui/src/Form/BreakLockForm.php
index 464920b..6e93848 100644
--- a/core/modules/views_ui/src/Form/BreakLockForm.php
+++ b/core/modules/views_ui/src/Form/BreakLockForm.php
@@ -5,7 +5,7 @@ namespace Drupal\views_ui\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormStateInterface;
-use Drupal\user\SharedTempStoreFactory;
+use Drupal\Core\TempStore\SharedTempStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -23,9 +23,9 @@ class BreakLockForm extends EntityConfirmFormBase {
protected $entityManager;
/**
- * Stores the user tempstore.
+ * Stores the shared tempstore.
*
- * @var \Drupal\user\SharedTempStore
+ * @var \Drupal\Core\TempStore\SharedTempStore
*/
protected $tempStore;
@@ -34,7 +34,7 @@ class BreakLockForm extends EntityConfirmFormBase {
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The Entity manager.
- * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
* The factory for the temp store object.
*/
public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory) {
@@ -48,7 +48,7 @@ class BreakLockForm extends EntityConfirmFormBase {
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
- $container->get('user.shared_tempstore')
+ $container->get('tempstore.shared')
);
}
diff --git a/core/modules/views_ui/src/ParamConverter/ViewUIConverter.php b/core/modules/views_ui/src/ParamConverter/ViewUIConverter.php
index ad718ba..fb19d18 100644
--- a/core/modules/views_ui/src/ParamConverter/ViewUIConverter.php
+++ b/core/modules/views_ui/src/ParamConverter/ViewUIConverter.php
@@ -8,7 +8,7 @@ use Drupal\Core\ParamConverter\AdminPathConfigEntityConverter;
use Drupal\Core\Routing\AdminContext;
use Symfony\Component\Routing\Route;
use Drupal\Core\ParamConverter\ParamConverterInterface;
-use Drupal\user\SharedTempStoreFactory;
+use Drupal\Core\TempStore\SharedTempStoreFactory;
use Drupal\views_ui\ViewUI;
/**
@@ -32,7 +32,7 @@ class ViewUIConverter extends AdminPathConfigEntityConverter implements ParamCon
/**
* Stores the tempstore factory.
*
- * @var \Drupal\user\SharedTempStoreFactory
+ * @var \Drupal\Core\TempStore\SharedTempStoreFactory
*/
protected $tempStoreFactory;
@@ -41,7 +41,7 @@ class ViewUIConverter extends AdminPathConfigEntityConverter implements ParamCon
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
- * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
* The factory for the temp store object.
*/
public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory, ConfigFactoryInterface $config_factory = NULL, AdminContext $admin_context = NULL) {
diff --git a/core/modules/views_ui/src/ViewEditForm.php b/core/modules/views_ui/src/ViewEditForm.php
index 9c1d58a..cea587e 100644
--- a/core/modules/views_ui/src/ViewEditForm.php
+++ b/core/modules/views_ui/src/ViewEditForm.php
@@ -11,7 +11,7 @@ use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\ElementInfoManagerInterface;
use Drupal\Core\Url;
-use Drupal\user\SharedTempStoreFactory;
+use Drupal\Core\TempStore\SharedTempStoreFactory;
use Drupal\views\Views;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -27,7 +27,7 @@ class ViewEditForm extends ViewFormBase {
/**
* The views temp store.
*
- * @var \Drupal\user\SharedTempStore
+ * @var \Drupal\Core\TempStore\SharedTempStore
*/
protected $tempStore;
@@ -55,7 +55,7 @@ class ViewEditForm extends ViewFormBase {
/**
* Constructs a new ViewEditForm object.
*
- * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory
+ * @param \Drupal\Core\TempStore\SharedTempStoreFactory $temp_store_factory
* The factory for the temp store object.
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
* The request stack object.
@@ -76,7 +76,7 @@ class ViewEditForm extends ViewFormBase {
*/
public static function create(ContainerInterface $container) {
return new static(
- $container->get('user.shared_tempstore'),
+ $container->get('tempstore.shared'),
$container->get('request_stack'),
$container->get('date.formatter'),
$container->get('element_info')
diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php
index 2e7fabd..b2be658 100644
--- a/core/modules/views_ui/src/ViewUI.php
+++ b/core/modules/views_ui/src/ViewUI.php
@@ -48,7 +48,7 @@ class ViewUI implements ViewEntityInterface {
* If this view is locked for editing.
*
* If this view is locked it will contain the result of
- * \Drupal\user\SharedTempStore::getMetadata(). Which can be a stdClass or
+ * \Drupal\Core\TempStore\SharedTempStore::getMetadata(). Which can be a stdClass or
* NULL.
*
* @var stdClass
@@ -855,7 +855,7 @@ class ViewUI implements ViewEntityInterface {
}
/**
- * Sets a cached view object in the user tempstore.
+ * Sets a cached view object in the shared tempstore.
*/
public function cacheSet() {
if ($this->isLocked()) {
@@ -878,7 +878,7 @@ class ViewUI implements ViewEntityInterface {
$executable->default_display = NULL;
$executable->query = NULL;
$executable->displayHandlers = NULL;
- \Drupal::service('user.shared_tempstore')->get('views')->set($this->id(), $this);
+ \Drupal::service('tempstore.shared')->get('views')->set($this->id(), $this);
}
/**
diff --git a/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php b/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
index 51e489d..c8da87c 100644
--- a/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
+++ b/core/modules/views_ui/tests/src/Functional/CachedDataUITest.php
@@ -3,7 +3,7 @@
namespace Drupal\Tests\views_ui\Functional;
/**
- * Tests the user tempstore cache in the UI.
+ * Tests the shared tempstore cache in the UI.
*
* @group views_ui
*/
@@ -17,12 +17,12 @@ class CachedDataUITest extends UITestBase {
public static $testViews = ['test_view'];
/**
- * Tests the user tempstore views data in the UI.
+ * Tests the shared tempstore views data in the UI.
*/
public function testCacheData() {
$views_admin_user_uid = $this->fullAdminUser->id();
- $temp_store = $this->container->get('user.shared_tempstore')->get('views');
+ $temp_store = $this->container->get('tempstore.shared')->get('views');
// The view should not be locked.
$this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'The view is not locked.');
@@ -40,7 +40,7 @@ class CachedDataUITest extends UITestBase {
// Cancel the view edit and make sure the cache is deleted.
$this->drupalPostForm(NULL, [], t('Cancel'));
- $this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'User tempstore data has been removed.');
+ $this->assertEqual($temp_store->getMetadata('test_view'), NULL, 'Shared tempstore data has been removed.');
// Test we are redirected to the view listing page.
$this->assertUrl('admin/structure/views', [], 'Redirected back to the view listing page.');
diff --git a/core/modules/views_ui/views_ui.services.yml b/core/modules/views_ui/views_ui.services.yml
index 27fa334..adf87e6 100644
--- a/core/modules/views_ui/views_ui.services.yml
+++ b/core/modules/views_ui/views_ui.services.yml
@@ -1,7 +1,7 @@
services:
paramconverter.views_ui:
class: Drupal\views_ui\ParamConverter\ViewUIConverter
- arguments: ['@entity.manager', '@user.shared_tempstore', '@config.factory', '@router.admin_context']
+ arguments: ['@entity.manager', '@tempstore.shared', '@config.factory', '@router.admin_context']
tags:
- { name: paramconverter, priority: 10 }
lazy: true