You are here

function migrate_d2d_update_7201 in Drupal-to-Drupal data migration 7.2

Make sure any previously-encrypted source_database arguments are appropriately marked as encrypted going forward.

File

./migrate_d2d.install, line 11
Update functions for migrate_d2d.

Code

function migrate_d2d_update_7201() {
  $result = db_select('migrate_group', 'mg')
    ->fields('mg', array(
    'name',
    'arguments',
  ))
    ->execute();
  foreach ($result as $row) {
    $arguments = unserialize($row->arguments);
    if (!isset($arguments['encrypted_arguments'])) {
      if (isset($arguments['source_database']) && !is_array($arguments['source_database'])) {
        $arguments['encrypted_arguments'] = array(
          'source_database',
        );
        db_update('migrate_group')
          ->fields(array(
          'arguments' => serialize($arguments),
        ))
          ->condition('name', $row->name)
          ->execute();
      }
    }
  }
}