Commit 5491ff81 authored by git's avatar git Committed by Blanca Esqueda
Browse files

Issue #2873074 by acmoncadab4, dabito: Drush commands - The super...

Issue #2873074 by acmoncadab4, dabito: Drush commands - The super administrator user cannot be deleted.
parent 0c7ab694
Loading
Loading
Loading
Loading
+7 −2
Changes for src/Commands/ContentSyncCommands.php: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -368,6 +368,10 @@ class ContentSyncCommands extends DrushCommands {
      $error = TRUE;
      $item = array_pop($context['sandbox']['queue']);
      list($entity_type_id, , $uuid) = explode('.', $item);
      if ($entity_type_id == 'user' && $uuid == $this->entityManager->getStorage('user')->load(1)->uuid()) {
        $message = $this->t('The super administrator user cannot be deleted.');
      }
      else {
        $entity = $this->entityManager->loadEntityByUuid($entity_type_id, $uuid);
        if ($entity) {
          try {
@@ -390,6 +394,7 @@ class ContentSyncCommands extends DrushCommands {
          ]);
        }
      }
    }
    $context['results'][] = TRUE;
    $context['sandbox']['progress']++;
    $context['message'] = $message;
@@ -414,8 +419,8 @@ class ContentSyncCommands extends DrushCommands {
    if ($success) {
      if (!empty($results['errors'])) {
        foreach ($results['errors'] as $error) {
          \Drupal::getContainer()->get('content_sync.commands')->io()->writeln($error);
          \Drupal::logger('config_sync')->error($error);
          \Drupal::getContainer()->get('content_sync.commands')->io()->writeln($error->__toString());
          \Drupal::logger('config_sync')->error($error->__toString());
        }
        \Drupal::getContainer()->get('content_sync.commands')->io()->writeln(\Drupal::translation()
          ->translate('The content was imported with errors.')->__toString());