function lockr_migrate_keys_batch_op in Lockr 7.2
Same name and namespace in other branches
- 7.3 lockr.forms.inc \lockr_migrate_keys_batch_op()
1 string reference to 'lockr_migrate_keys_batch_op'
File
- ./
lockr.forms.inc, line 69
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']);
$key_config = key_get_key($key_id);
$value = key_get_key_value($key_config);
$key_client = lockr_key_client();
$encoded = _lockr_set_key($key_id, $value, $key_config['label']);
db_update('key_config')
->fields([
'key_provider_settings' => serialize([
'encoded' => $encoded,
]),
])
->condition('id', $key_id)
->execute();
if ($context['sandbox']['key_ids']) {
$num = $context['sandbox']['total'] - count($context['sandbox']['key_ids']);
$context['finished'] = $num / $context['sandbox']['total'];
}
}