You are here

public function MigrationBase::__construct in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 includes/base.inc \MigrationBase::__construct()

General initialization of a MigrationBase object.

3 calls to MigrationBase::__construct()
Migration::__construct in includes/migration.inc
General initialization of a Migration object.
WineFinishMigration::__construct in migrate_example/wine.inc
General initialization of a MigrationBase object.
WinePrepMigration::__construct in migrate_example/wine.inc
General initialization of a MigrationBase object.
3 methods override MigrationBase::__construct()
Migration::__construct in includes/migration.inc
General initialization of a Migration object.
WineFinishMigration::__construct in migrate_example/wine.inc
General initialization of a MigrationBase object.
WinePrepMigration::__construct in migrate_example/wine.inc
General initialization of a MigrationBase object.

File

includes/base.inc, line 297
Defines the base class for migration processes.

Class

MigrationBase
The base class for all objects representing distinct steps in a migration process. Most commonly these will be Migration objects which actually import data from a source into a Drupal destination, but by deriving classes directly from MigrationBase…

Code

public function __construct($group = NULL) {
  $this->machineName = $this
    ->generateMachineName();
  if (empty($group)) {
    $this->group = MigrateGroup::getInstance('default');
  }
  else {
    $this->group = $group;
  }

  // Record the memory limit in bytes
  // @todo: Most of the rest of this could be static members
  $limit = trim(ini_get('memory_limit'));
  if ($limit == '-1') {
    $this->memoryLimit = PHP_INT_MAX;
  }
  else {
    if (!is_numeric($limit)) {
      $last = strtolower($limit[strlen($limit) - 1]);
      switch ($last) {
        case 'g':
          $limit *= 1024;
        case 'm':
          $limit *= 1024;
        case 'k':
          $limit *= 1024;
          break;
        default:
          throw new Exception(t('Invalid PHP memory_limit !limit', array(
            '!limit' => $limit,
          )));
      }
    }
    $this->memoryLimit = $limit;
  }

  // Record the time limit
  $this->timeLimit = ini_get('max_execution_time');

  // Make sure we clear our semaphores in case of abrupt exit
  register_shutdown_function(array(
    $this,
    'endProcess',
  ));
}