You are here

function mollie_payment_update_7101 in Mollie Payment 7.2

Same name and namespace in other branches
  1. 7 mollie_payment.install \mollie_payment_update_7101()

Move payment method configuration from the variable store to an own database table.

File

./mollie_payment.install, line 58
Install and update hooks for Mollie Payment.

Code

function mollie_payment_update_7101() {
  global $conf;

  // Create the database table.
  $schema = drupal_get_schema_unprocessed('mollie_payment');
  db_create_table('mollie_payment_payment_method_configurations', $schema['mollie_payment_payment_method_configurations']);

  // Move existing configurations.
  foreach ($conf as $name => $value) {
    if (strpos($name, 'mollie_payment_') === 0 && strpos($name, '_controller_data') !== FALSE) {
      $info = explode('_', $name);
      $pmid = $info[2];
      mollie_payment_payment_method_configuration_save($pmid, $value);
      variable_del($name);
    }
  }
}