function instagram_block_update_7100 in Instagram Block 7
Move config storage from single to multiple variables.
File
- ./
instagram_block.install, line 47 - File to handle module operations performed when (un-)installing module.
Code
function instagram_block_update_7100() {
$empty = array(
'count' => '4',
'width' => '100',
'height' => '100',
'img_resolution' => 'thumbnail',
'access_token' => '',
);
$admin = array(
'access_token' => '',
);
$block = array(
'count' => '',
'width' => '',
'height' => '',
'img_resolution' => '',
);
$old = variable_get('instagram_block_data', $empty);
// Move config from old to new variables.
foreach (array_keys($empty) as $key) {
if (in_array($key, array_keys($admin))) {
$admin[$key] = isset($old[$key]) ? $old[$key] : $empty[$key];
}
else {
$block[$key] = isset($old[$key]) ? $old[$key] : $empty[$key];
}
}
// Save new variables.
variable_set('instagram_block_admin_settings', $admin);
variable_set('instagram_block_user_block_settings', $block);
// Delete old variable.
variable_del('instagram_block_data');
}