diff --git a/core/modules/workspace/src/Annotation/RepositoryHandler.php b/core/modules/workspace/src/Annotation/RepositoryHandler.php index 516e690..89f7010 100644 --- a/core/modules/workspace/src/Annotation/RepositoryHandler.php +++ b/core/modules/workspace/src/Annotation/RepositoryHandler.php @@ -50,11 +50,4 @@ class RepositoryHandler extends Plugin { */ public $category = ''; - /** - * Whether the repository handles a remote destination or not. - * - * @var bool - */ - public $remote; - } diff --git a/core/modules/workspace/src/Entity/ReplicationLog.php b/core/modules/workspace/src/Entity/ReplicationLog.php index 5853820..b4969f9 100644 --- a/core/modules/workspace/src/Entity/ReplicationLog.php +++ b/core/modules/workspace/src/Entity/ReplicationLog.php @@ -110,20 +110,20 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields['history'] = BaseFieldDefinition::create('replication_history') ->setLabel(new TranslatableMarkup('Replication log history')) - ->setDescription(new TranslatableMarkup('The version id of the test entity.')) + ->setDescription(new TranslatableMarkup('The replication history.')) ->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); $fields['session_id'] = BaseFieldDefinition::create('uuid') ->setLabel(new TranslatableMarkup('Replication session ID')) ->setDescription(new TranslatableMarkup('The unique session ID of the last replication. Shortcut to the session_id in the last history item.')); - $fields['source_last_sequence'] = BaseFieldDefinition::create('string') + $fields['source_last_sequence'] = BaseFieldDefinition::create('integer') ->setLabel(new TranslatableMarkup('Last processed checkpoint')) - ->setDescription(new TranslatableMarkup('The last processed checkpoint. Shortcut to the source_last_sequence in the last history item.')); + ->setDescription(new TranslatableMarkup('The last processed checkpoint, used in partial deployments to a remote target. Shortcut to the recorded_sequence in the last history item.')); $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(new TranslatableMarkup('Status')) - ->setDescription(new TranslatableMarkup('Replication status')) + ->setDescription(new TranslatableMarkup('The replication status.')) ->setDefaultValue(TRUE); return $fields; diff --git a/core/modules/workspace/src/Entity/Workspace.php b/core/modules/workspace/src/Entity/Workspace.php index f8bac92..a39a8e7 100644 --- a/core/modules/workspace/src/Entity/Workspace.php +++ b/core/modules/workspace/src/Entity/Workspace.php @@ -111,11 +111,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setDescription(new TranslatableMarkup('The workspace to push to and pull from.')) ->setRevisionable(TRUE) ->setRequired(TRUE) - ->setDisplayOptions('form', [ - 'type' => 'workspace_upstream', - 'weight' => 4, - ]) - ->setDisplayConfigurable('form', TRUE) + ->setDefaultValue('local_workspace:live') ->addPropertyConstraints('value', [ 'Upstream' => [], ]); diff --git a/core/modules/workspace/src/Entity/WorkspaceAssociation.php b/core/modules/workspace/src/Entity/WorkspaceAssociation.php index db38755..e0fea8d 100644 --- a/core/modules/workspace/src/Entity/WorkspaceAssociation.php +++ b/core/modules/workspace/src/Entity/WorkspaceAssociation.php @@ -50,20 +50,20 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields['content_entity_type_id'] = BaseFieldDefinition::create('string') ->setLabel(new TranslatableMarkup('Content entity type ID')) - ->setDescription(new TranslatableMarkup('The ID of the content entity type this workspace is for.')) + ->setDescription(new TranslatableMarkup('The ID of the content entity type associated with this workspace.')) ->setSetting('max_length', EntityTypeInterface::ID_MAX_LENGTH) ->setRequired(TRUE) ->setRevisionable(TRUE); $fields['content_entity_id'] = BaseFieldDefinition::create('integer') ->setLabel(new TranslatableMarkup('Content entity ID')) - ->setDescription(new TranslatableMarkup('The ID of the content entity this workspace is for.')) + ->setDescription(new TranslatableMarkup('The ID of the content entity associated with this workspace.')) ->setRequired(TRUE) ->setRevisionable(TRUE); $fields['content_entity_revision_id'] = BaseFieldDefinition::create('integer') ->setLabel(new TranslatableMarkup('Content entity revision ID')) - ->setDescription(new TranslatableMarkup('The revision ID of the content entity this workspace is for.')) + ->setDescription(new TranslatableMarkup('The revision ID of the content entity associated with this workspace.')) ->setRequired(TRUE) ->setRevisionable(TRUE); diff --git a/core/modules/workspace/src/EntityAccess.php b/core/modules/workspace/src/EntityAccess.php index 8e2f561..453acc5 100644 --- a/core/modules/workspace/src/EntityAccess.php +++ b/core/modules/workspace/src/EntityAccess.php @@ -134,10 +134,6 @@ protected function bypassAccessResult(AccountInterface $account) { /** * Returns an array of workspace-specific permissions. * - * Note: This approach assumes that a site will have only a small number of - * workspace entities, under a dozen. If there are many dozens of workspaces - * defined then this approach will have scaling issues. - * * @return array * The workspace permissions. */ diff --git a/core/modules/workspace/src/Plugin/RepositoryHandler/LocalWorkspaceRepositoryHandler.php b/core/modules/workspace/src/Plugin/RepositoryHandler/LocalWorkspaceRepositoryHandler.php index d06e4f2..b5f56d1 100644 --- a/core/modules/workspace/src/Plugin/RepositoryHandler/LocalWorkspaceRepositoryHandler.php +++ b/core/modules/workspace/src/Plugin/RepositoryHandler/LocalWorkspaceRepositoryHandler.php @@ -23,7 +23,6 @@ * id = "local_workspace", * label = @Translation("Local workspace"), * description = @Translation("A workspace that is defined in the local Drupal installation."), - * remote = FALSE, * deriver = "Drupal\workspace\Plugin\Deriver\LocalWorkspaceRepositoryHandlerDeriver", * ) */ @@ -227,28 +226,13 @@ public function replicate(RepositoryHandlerInterface $source, RepositoryHandlerI // the history. return $this->updateReplicationLog($replication_log, [ 'entity_write_failures' => 0, - 'end_time' => (new \DateTime())->format('D, d M Y H:i:s e'), 'session_id' => $this->uuidService->generate(), - 'start_last_sequence' => $this->getLastSequenceId($replication_log), 'start_time' => $start_time->format('D, d M Y H:i:s e'), + 'end_time' => (new \DateTime())->format('D, d M Y H:i:s e'), ]); } /** - * Gets the last sequence ID from a replication log entity. - * - * @param \Drupal\workspace\ReplicationLogInterface $replication_log - * The replication log entity to get the last sequence ID from. - * - * @return int - * The last sequence ID for the replication log. - */ - protected function getLastSequenceId(ReplicationLogInterface $replication_log) { - $history = $replication_log->getHistory(); - return isset($history[0]['recorded_sequence']) ? $history[0]['recorded_sequence'] : 0; - } - - /** * Updates the replication log entity with the given history. * * @param \Drupal\workspace\ReplicationLogInterface $replication_log diff --git a/core/modules/workspace/src/RepositoryHandlerBase.php b/core/modules/workspace/src/RepositoryHandlerBase.php index 172f26c..df89f1a 100644 --- a/core/modules/workspace/src/RepositoryHandlerBase.php +++ b/core/modules/workspace/src/RepositoryHandlerBase.php @@ -34,13 +34,6 @@ public function getDescription() { /** * {@inheritdoc} */ - public function isRemote() { - return $this->getPluginDefinition()['remote']; - } - - /** - * {@inheritdoc} - */ public function calculateDependencies() { return []; } diff --git a/core/modules/workspace/src/RepositoryHandlerInterface.php b/core/modules/workspace/src/RepositoryHandlerInterface.php index 49f3dea..6f18288 100644 --- a/core/modules/workspace/src/RepositoryHandlerInterface.php +++ b/core/modules/workspace/src/RepositoryHandlerInterface.php @@ -42,14 +42,6 @@ public function getLabel(); public function getDescription(); /** - * Returns whether the repository handler is remote or not. - * - * @return bool - * TRUE if the repository handler is remote, FALSE otherwise. - */ - public function isRemote(); - - /** * Replicates content from a source repository to a target repository. * * @param \Drupal\workspace\RepositoryHandlerInterface $source diff --git a/core/modules/workspace/tests/src/Functional/WorkspaceTest.php b/core/modules/workspace/tests/src/Functional/WorkspaceTest.php index 097886f..e52d256 100644 --- a/core/modules/workspace/tests/src/Functional/WorkspaceTest.php +++ b/core/modules/workspace/tests/src/Functional/WorkspaceTest.php @@ -74,7 +74,6 @@ public function testWorkspaceOwner() { $this->drupalPostForm('/admin/config/workflow/workspace/add', [ 'id' => 'test_workspace', 'label' => 'Test workspace', - 'upstream[0][value]' => 'local_workspace:live', ], 'Save'); $storage = \Drupal::entityTypeManager()->getStorage('workspace'); diff --git a/core/modules/workspace/tests/src/Functional/WorkspaceTestUtilities.php b/core/modules/workspace/tests/src/Functional/WorkspaceTestUtilities.php index 328a51b..66ee778 100644 --- a/core/modules/workspace/tests/src/Functional/WorkspaceTestUtilities.php +++ b/core/modules/workspace/tests/src/Functional/WorkspaceTestUtilities.php @@ -47,19 +47,14 @@ protected function getOneEntityByLabel($type, $label) { * The label of the workspace to create. * @param string $id * The ID of the workspace to create. - * @param string $upstream - * The ID of the replication handler plugin of the workspace. * - * @return \Drupal\Core\Entity\EntityInterface + * @return \Drupal\workspace\WorkspaceInterface * The workspace that was just created. - * - * @throws \Behat\Mink\Exception\ElementNotFoundException */ - protected function createWorkspaceThroughUi($label, $id, $upstream = 'local_workspace:live') { + protected function createWorkspaceThroughUi($label, $id) { $this->drupalPostForm('/admin/config/workflow/workspace/add', [ 'id' => $id, 'label' => $label, - 'upstream[0][value]' => $upstream, ], 'Save'); $this->getSession()->getPage()->hasContent("$label ($id)");