You are here

public static function MigrationBase::decryptArguments in Migrate 7.2

Make sure any arguments we want to be decrypted get decrypted.

Parameters

array $arguments:

Return value

array

2 calls to MigrationBase::decryptArguments()
MigrateGroup::getInstance in includes/group.inc
Retrieve (creating if necessary) an instance of the named group.
MigrationBase::getInstance in includes/base.inc
Return the single instance of the given migration.

File

includes/base.inc, line 1362
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 static function decryptArguments(array $arguments) {
  if (isset($arguments['encrypted_arguments'])) {
    foreach ($arguments['encrypted_arguments'] as $argument_name) {
      if (isset($arguments[$argument_name])) {
        $decrypted_string = self::decrypt($arguments[$argument_name]);

        // A decryption failure will return FALSE and issue a notice. We need
        // to distinguish a failure from a serialized FALSE.
        $unserialized_value = @unserialize($decrypted_string);
        if ($unserialized_value === FALSE && $decrypted_string != serialize(FALSE)) {
          self::displayMessage(t('Failed to decrypt argument %argument_name', array(
            '%argument_name' => $argument_name,
          )));
          unset($arguments[$argument_name]);
        }
        else {
          $arguments[$argument_name] = $unserialized_value;
        }
      }
    }
  }
  return $arguments;
}