You are here

function encrypt_update_7203 in Encrypt 7.3

Same name and namespace in other branches
  1. 7.2 encrypt.install \encrypt_update_7203()

Migrate any settings in the variable table to a default configuration.

File

./encrypt.install, line 298
Install, update and uninstall functions for the encrypt module.

Code

function encrypt_update_7203() {
  $t = get_t();
  $method = variable_get('encrypt_encryption_method', 'default');
  $provider = variable_get('encrypt_key_provider', 'drupal_private_key');
  $provider_settings = variable_get('encrypt_key_providers_' . $provider . '_settings', '');
  db_insert('encrypt_config')
    ->fields(array(
    'name' => 'default',
    'label' => $t('Default'),
    'description' => $t('The default configuration.'),
    'method' => $method,
    'method_settings' => '',
    'provider' => $provider,
    'provider_settings' => serialize($provider_settings),
    'enabled' => 1,
    'created' => REQUEST_TIME,
    'changed' => REQUEST_TIME,
  ))
    ->execute();
  variable_set('encrypt_default_config', 'default');
  variable_del('encrypt_encryption_method');
  variable_del('encrypt_key_provider');
  variable_del('encrypt_key_providers_' . $provider . '_settings');
}