public function MigrateExecutable::__construct in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/MigrateExecutable.php \Drupal\migrate\MigrateExecutable::__construct()
Constructs a MigrateExecutable and verifies and sets the memory limit.
Parameters
\Drupal\migrate\Entity\MigrationInterface $migration: The migration to run.
\Drupal\migrate\MigrateMessageInterface $message: The message to record.
\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.
Throws
\Drupal\migrate\MigrateException
File
- core/
modules/ migrate/ src/ MigrateExecutable.php, line 114 - Contains \Drupal\migrate\MigrateExecutable.
Class
- MigrateExecutable
- Defines a migrate executable class.
Namespace
Drupal\migrateCode
public function __construct(MigrationInterface $migration, MigrateMessageInterface $message, EventDispatcherInterface $event_dispatcher = NULL) {
$this->migration = $migration;
$this->message = $message;
$this->migration
->getIdMap()
->setMessage($message);
$this->eventDispatcher = $event_dispatcher;
// Record the memory limit in bytes
$limit = trim(ini_get('memory_limit'));
if ($limit == '-1') {
$this->memoryLimit = PHP_INT_MAX;
}
else {
if (!is_numeric($limit)) {
$last = strtolower(substr($limit, -1));
switch ($last) {
case 'g':
$limit *= 1024;
case 'm':
$limit *= 1024;
case 'k':
$limit *= 1024;
break;
default:
$limit = PHP_INT_MAX;
$this->message
->display($this
->t('Invalid PHP memory_limit @limit, setting to unlimited.', array(
'@limit' => $limit,
)));
}
}
$this->memoryLimit = $limit;
}
}