Skip to content
Snippets Groups Projects

Resolve #3217783 "D11"

Closed Pierre Rudloff requested to merge issue/drupal-3217783:3217783-d11 into 11.x
All threads resolved!
Files
2
@@ -22,13 +22,6 @@ final class ExportStorageManager implements StorageManagerInterface {
*/
const LOCK_NAME = 'config_storage_export_manager';
/**
* The active configuration storage.
*
* @var \Drupal\Core\Config\StorageInterface
*/
protected $active;
/**
* The database storage.
*
@@ -36,20 +29,6 @@ final class ExportStorageManager implements StorageManagerInterface {
*/
protected $storage;
/**
* The event dispatcher.
*
* @var \Symfony\Contracts\EventDispatcher\EventDispatcherInterface
*/
protected $eventDispatcher;
/**
* The used lock backend instance.
*
* @var \Drupal\Core\Lock\LockBackendInterface
*/
protected $lock;
/**
* ExportStorageManager constructor.
*
@@ -57,15 +36,17 @@ final class ExportStorageManager implements StorageManagerInterface {
* The active config storage to prime the export storage.
* @param \Drupal\Core\Database\Connection $connection
* The database connection.
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher
* @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The event dispatcher.
* @param \Drupal\Core\Lock\LockBackendInterface $lock
* The used lock backend instance.
*/
public function __construct(StorageInterface $active, Connection $connection, EventDispatcherInterface $event_dispatcher, LockBackendInterface $lock) {
$this->active = $active;
$this->eventDispatcher = $event_dispatcher;
$this->lock = $lock;
public function __construct(
protected StorageInterface $active,
protected Connection $connection,
protected EventDispatcherInterface $eventDispatcher,
protected LockBackendInterface $lock,
) {
// The point of this service is to provide the storage and dispatch the
// event when needed, so the storage itself can not be a service.
$this->storage = new DatabaseStorage($connection, 'config_export');
@@ -84,7 +65,11 @@ public function getStorage() {
}
}
// Wrapping the queries in a transaction for performance gain.
$transaction = $this->connection->startTransaction();
self::replaceStorageContents($this->active, $this->storage);
unset($transaction);
$this->eventDispatcher->dispatch(new StorageTransformEvent($this->storage), ConfigEvents::STORAGE_TRANSFORM_EXPORT);
return new ReadOnlyStorage($this->storage);
Loading