public function ConfirmClearReplicationQueueForm::clearReplicationQueue in Workspace 8
Clears the replication queue.
See also
\Drupal\workspace\Plugin\QueueWorker\WorkspaceReplication::processItem().
1 call to ConfirmClearReplicationQueueForm::clearReplicationQueue()
- ConfirmClearReplicationQueueForm::submitForm in src/
Form/ ConfirmClearReplicationQueueForm.php - Form submission handler.
File
- src/
Form/ ConfirmClearReplicationQueueForm.php, line 66
Class
- ConfirmClearReplicationQueueForm
- Class ConfirmClearReplicationQueueForm.
Namespace
Drupal\workspace\FormCode
public function clearReplicationQueue() {
// We actually don't clear the replication queue, we just mark as failed all
// the queued replications - this will allow, during the queue item
// processing to not do any actual processing for an item that contains the
// failed replication, it will just go out the queue without doing anything
// with it.
$queued_items_deleted = FALSE;
/** @var Replication[] $queued_replications */
$queued_replications = $this->entityTypeManager
->getStorage('replication')
->loadByProperties([
'replication_status' => Replication::QUEUED,
]);
foreach ($queued_replications as $replication) {
$replication
->setReplicationStatusFailed()
->setReplicationFailInfo($this
->t('This deployment has been marked as failed manually, when clearing the replication queue.'))
->save();
$queued_items_deleted = TRUE;
}
return $queued_items_deleted;
}