You are here

function access_update_7104 in Access Control Kit 7

Move access scheme settings from field definition to {access_scheme} table.

File

./access.install, line 281
Install, update and uninstall functions for the access control kit module.

Code

function access_update_7104() {

  // Create the scheme settings field.
  db_add_field('access_scheme', 'settings', array(
    'description' => 'Serialized data containing settings specific to the scheme type.',
    'type' => 'blob',
    'size' => 'big',
    'serialize' => TRUE,
  ));

  // Update the scheme and field configs.
  foreach (access_scheme_load_multiple() as $scheme) {
    if (!empty($scheme->realm_field['settings']['arguments'])) {
      $settings = $scheme->realm_field['settings']['arguments'];
      db_update('access_scheme')
        ->fields(array(
        'settings' => serialize($settings),
      ))
        ->condition('sid', $scheme->sid)
        ->execute();
      $scheme->realm_field['settings']['arguments'] = array();
      field_update_field($scheme->realm_field);
    }
  }
}