You are here

function _migrate_progress_message in Migrate 6

Generate a progress message

Parameters

$starttime: microtime() when this piece of work began

$numitems: Number of items that were processed

$description: Name (description) of the content set being processed

$import: TRUE for an import process, FALSE for a clearing process

$status: Status of the work

Return value

Formatted message

2 calls to _migrate_progress_message()
migrate_content_process_clear in ./migrate.module
Clear migrated objects from the specified content set
migrate_content_process_import in ./migrate.module
Import objects from the specified content set

File

./migrate.module, line 1023
This module provides tools at "administer >> content >> migrate" for analyzing data from various sources and importing them into Drupal tables.

Code

function _migrate_progress_message($starttime, $numitems, $description, $import = TRUE, $result = MIGRATE_RESULT_COMPLETED) {
  $time = microtime(TRUE) - $starttime;
  if ($time > 0) {
    $perminute = round(60 * $numitems / $time);
    $time = round($time, 1);
  }
  else {
    $perminute = '?';
  }
  if ($import) {
    switch ($result) {
      case MIGRATE_RESULT_COMPLETED:
        $basetext = "Imported !numitems in !time sec (!perminute/min) - done with '!description'";
        break;
      case MIGRATE_RESULT_FAILED:
        $basetext = "Imported !numitems in !time sec (!perminute/min) - failure with '!description'";
        break;
      case MIGRATE_RESULT_INCOMPLETE:
        $basetext = "Imported !numitems in !time sec (!perminute/min) - continuing with '!description'";
        break;
      case MIGRATE_RESULT_STOPPED:
        $basetext = "Imported !numitems in !time sec (!perminute/min) - stopped '!description'";
        break;
    }
  }
  else {
    switch ($result) {
      case MIGRATE_RESULT_COMPLETED:
        $basetext = "Deleted !numitems in !time sec (!perminute/min) - done with '!description'";
        break;
      case MIGRATE_RESULT_FAILED:
        $basetext = "Deleted !numitems in !time sec (!perminute/min) - failure with '!description'";
        break;
      case MIGRATE_RESULT_INCOMPLETE:
        $basetext = "Deleted !numitems in !time sec (!perminute/min) - continuing with '!description'";
        break;
      case MIGRATE_RESULT_STOPPED:
        $basetext = "Deleted !numitems in !time sec (!perminute/min) - stopped '!description'";
        break;
    }
  }
  $message = t($basetext, array(
    '!numitems' => $numitems,
    '!time' => $time,
    '!perminute' => $perminute,
    '!description' => $description,
  ));
  return $message;
}