You are here

function gathercontent_drush_import_process_finished in GatherContent 8.5

Same name and namespace in other branches
  1. 8.3 gathercontent.drush.inc \gathercontent_drush_import_process_finished()
  2. 8.4 gathercontent.drush.inc \gathercontent_drush_import_process_finished()
  3. 7.3 gathercontent.drush.inc \gathercontent_drush_import_process_finished()

Batch process "finished" callback.

1 string reference to 'gathercontent_drush_import_process_finished'
drush_gathercontent_import in ./gathercontent.drush.inc
Implements drush_COMMAND().

File

./gathercontent.drush.inc, line 271
Drush command to cli config import.

Code

function gathercontent_drush_import_process_finished($success, $results, $operations) {
  if ($success) {
    if ($results['success'] > 0) {
      drush_log(\Drupal::translation()
        ->formatPlural($results['success'], '1 item was imported successfully.', '@count items were imported successfully.'));
    }
    if ($results['failed'] > 0) {
      drush_log(\Drupal::translation()
        ->formatPlural($results['failed'], '1 item was not imported. Check errors below.', '@count items were not imported. Check errors below.'), 'error');
    }
    if ($results['failed'] == 0 && $results['success'] == 0) {
      drush_log(\Drupal::translation()
        ->translate('Nothing was imported or updated.'));
    }
  }
  else {
    $error_operation = reset($operations);
    drush_set_error('gathercontent_import_failed', dt('An error occurred while processing @operation with arguments : @args', [
      '@operation' => $error_operation[0],
      '@args' => print_r($error_operation[0], TRUE),
    ]));
  }
}