function backup_migrate_get_destinations in Backup and Migrate 5.2
Same name and namespace in other branches
- 8.2 includes/destinations.inc \backup_migrate_get_destinations()
- 8.3 includes/destinations.inc \backup_migrate_get_destinations()
- 6.3 includes/destinations.inc \backup_migrate_get_destinations()
- 6.2 includes/destinations.inc \backup_migrate_get_destinations()
- 7.3 includes/destinations.inc \backup_migrate_get_destinations()
- 7.2 includes/destinations.inc \backup_migrate_get_destinations()
Get all the available backup destination.
Parameters
$op: The operation which will be performed on the destination. Hooks can use this to return only those destinations appropriate for the given op. Options include: 'manual backup' - destinations available for manual backup 'scheduled backup' - destinations available for schedules backup 'list files' - destinations whose backup files can be listed 'restore' - destinations whose files can be restored from 'all' - all available destinations should be returned
3 calls to backup_migrate_get_destinations()
- backup_migrate_get_destination in includes/
destinations.inc - Get the destination info for the destination with the given ID, or NULL if none exists.
- backup_migrate_ui_destination_display_destinations in includes/
destinations.inc - List the available backup destinations destination in the UI.
- _backup_migrate_get_destination_form_item_options in includes/
destinations.inc - Get the destination options as an options array for a form item.
File
- includes/
destinations.inc, line 74 - All of the destination handling code needed for Backup and Migrate.
Code
function backup_migrate_get_destinations($op = 'all') {
static $destinations = NULL;
// Get the list of destinations and cache them locally.
if ($destinations === NULL) {
$types = backup_migrate_get_destination_types();
$all_destinations = module_invoke_all('backup_migrate_destinations');
// Merge any type specific info such as callbacks and defaults.
foreach ($all_destinations as $destination) {
if ($destination['type'] && isset($types[$destination['type']])) {
$destination = array_merge($types[$destination['type']], $destination);
}
// Parse the location in case that's needed
$parts = _backup_migrate_destination_parse_url($destination['location']);
$destinations[$destination['destination_id']] = $destination + $parts;
}
}
if ($op == 'all') {
return $destinations;
}
$out = array();
foreach ($destinations as $key => $destination) {
if (in_array($op, (array) $destination['ops'])) {
$out[$key] = $destination;
}
}
return $out;
}