You are here

function password_policy_update_7108 in Password Policy 7

Rename "Complexity" constraint to "Character Types".

File

./password_policy.install, line 496
Password Policy module installation and upgrade code.

Code

function password_policy_update_7108() {
  $result = db_query('SELECT pid, constraints FROM {password_policy}');
  foreach ($result as $row) {
    $pid = $row->pid;
    $constraints = $row->constraints;
    $constraints = unserialize($constraints);
    if (isset($constraints['complexity'])) {
      $constraints['character_types'] = $constraints['complexity'];
      unset($constraints['complexity']);
      $constraints = serialize($constraints);
      db_update('password_policy')
        ->fields(array(
        'constraints' => $constraints,
      ))
        ->condition('pid', $pid)
        ->execute();
    }
  }
}