function backup_migrate_prune_update_7100 in Backup and migrate prune 7
Same name and namespace in other branches
- 7.2 backup_migrate_prune.install \backup_migrate_prune_update_7100()
Updates Sunday from code 0 to code 7.
File
- ./
backup_migrate_prune.install, line 65 - Install hooks for Backup and Migrate.
Code
function backup_migrate_prune_update_7100(&$sandbox) {
// Find all gardeners that had a 0 for the keep day and change them to a 7
$records = db_select('backup_migrate_gardener', 'bmg')
->fields('bmg', array(
'settings',
'gardener_id',
))
->execute();
foreach ($records as $record) {
$settings = unserialize($record->settings);
if ($settings['day']['keep'] == 0) {
// Modify the settings
$settings['day']['keep'] = 7;
// Save the record
$record = array(
'settings' => $settings,
'gardener_id' => $record->gardener_id,
);
drupal_write_record('backup_migrate_gardener', $record, 'gardener_id');
}
}
}