You are here

function lockr_migrate_keys_batch_op in Lockr 7.3

Same name and namespace in other branches
  1. 7.2 lockr.forms.inc \lockr_migrate_keys_batch_op()
1 string reference to 'lockr_migrate_keys_batch_op'
lockr_migrate_keys_form_submit in ./lockr.forms.inc

File

./lockr.forms.inc, line 74

Code

function lockr_migrate_keys_batch_op($key_ids, &$context) {
  if (empty($context['sandbox'])) {
    $context['sandbox']['total'] = count($key_ids);
    $context['sandbox']['key_ids'] = $key_ids;
  }
  $key_id = array_shift($context['sandbox']['key_ids']);
  $secret_info = lockr_secret_info();
  $key_config = key_get_key($key_id);
  $value = key_get_key_value($key_config);
  $secret_info
    ->setSecretInfo($key_id, []);
  _lockr_set_key($key_id, $value, $key_config['label']);
  if ($context['sandbox']['key_ids']) {
    $num = $context['sandbox']['total'] - count($context['sandbox']['key_ids']);
    $context['finished'] = $num / $context['sandbox']['total'];
  }
}