diff --git a/commerce_kickstart.install_callbacks.inc b/commerce_kickstart.install_callbacks.inc index 71c210c..779d898 100644 --- a/commerce_kickstart.install_callbacks.inc +++ b/commerce_kickstart.install_callbacks.inc @@ -202,9 +202,45 @@ function _commerce_kickstart_taxonomy_menu($operation, &$context) { * @see commerce_kickstart_import_content() */ function _commerce_kickstart_import($operation, $type, &$context) { - $context['message'] = t('@operation', array('@operation' => $type)); - $migration = Migration::getInstance($operation); - $migration->processImport(); + $migration = Migration::getInstance($operation); + $totalCount = $migration->sourceCount(); + + $message = 'Importing @operation content (@count)...'; + $variables = array( + '@operation' => $operation, + '@count' => format_plural($totalCount, '1 record', '@count records'), + ); + + $context['message'] = t($message, $variables); + + /* @var Migration $migration */ + $result = $migration->processImport(); + + // Allow resuming when incomplete. + if ($result == MigrationBase::RESULT_INCOMPLETE) { + $processedCount = $migration->processedCount(); + + $context['finished'] = $processedCount / $totalCount; + + $context['message'] + = t('Importing @operation content - @current of @total...', + array( + '@operation' => $operation, + '@current' + => format_plural( + $migration->processedCount(), + '1 record', + '@count records'), + '@total' + => format_plural( + $migration->sourceCount(), + '1 record', + '@count records'), + )); + } + else { + $context['finished'] = 1; + } } /**