function backup_migrate_schedule::generate_keep_description in Backup and Migrate 8.3
Same name and namespace in other branches
- 6.3 includes/schedules.inc \backup_migrate_schedule::generate_keep_description()
- 7.3 includes/schedules.inc \backup_migrate_schedule::generate_keep_description()
Format a number to keep in human readable from
2 calls to backup_migrate_schedule::generate_keep_description()
- backup_migrate_schedule::edit_form in includes/
schedules.inc - Get the edit form.
- backup_migrate_schedule::get_keep_description in includes/
schedules.inc - Format the number to keep in human-readable form.
File
- includes/
schedules.inc, line 327 - All of the schedule handling code needed for Backup and Migrate.
Class
- backup_migrate_schedule
- A schedule class for crud operations.
Code
function generate_keep_description($keep, $terse = TRUE) {
if ($keep == BACKUP_MIGRATE_KEEP_ALL) {
return t('all backups');
}
else {
if ($keep == BACKUP_MIGRATE_SMART_DELETE) {
$keep_hourly = variable_get('backup_migrate_smart_keep_hourly', BACKUP_MIGRATE_SMART_KEEP_HOURLY);
$keep_daily = variable_get('backup_migrate_smart_keep_daily', BACKUP_MIGRATE_SMART_KEEP_DAILY);
$keep_weekly = variable_get('backup_migrate_smart_keep_weekly', BACKUP_MIGRATE_SMART_KEEP_WEEKLY);
if ($terse) {
return t('!hours hourly, !days daily, !weeks weekly backups', array(
'!hours' => $keep_hourly == PHP_INT_MAX ? t('all') : $keep_hourly,
'!days' => $keep_daily == PHP_INT_MAX ? t('all') : $keep_daily,
'!weeks' => $keep_weekly == PHP_INT_MAX ? t('all') : $keep_weekly,
));
}
else {
return t('hourly backups !hours, daily backups !days and weekly backups !weeks', array(
'!hours' => $keep_hourly == PHP_INT_MAX ? t('forever') : format_plural($keep_hourly, 'for 1 hour', 'for the past @count hours'),
'!days' => $keep_daily == PHP_INT_MAX ? t('forever') : format_plural($keep_daily, 'for 1 day', 'for the past @count days'),
'!weeks' => $keep_weekly == PHP_INT_MAX ? t('forever') : format_plural($keep_weekly, 'for 1 week', 'for the past @count weeks'),
));
}
}
}
return format_plural($keep, 'last 1 backup', 'last @count backups');
}