You are here

function backup_migrate_get_locations in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.3 includes/locations.inc \backup_migrate_get_locations()
  2. 7.3 includes/locations.inc \backup_migrate_get_locations()

Get all the available backup location.

Parameters

$op: The operation which will be performed on the location. Hooks can use this to return only those locations appropriate for the given op. Options include: 'manual backup' - locations available for manual backup 'scheduled backup' - locations available for schedules backup 'list files' - locations whose backup files can be listed 'restore' - locations whose files can be restored from 'all' - all available locations should be returned

1 call to backup_migrate_get_locations()
backup_migrate_get_location in includes/locations.inc
Get the location of the given id.

File

includes/locations.inc, line 47

Code

function backup_migrate_get_locations($op = 'all') {
  static $locations = NULL;

  // Get the list of locations and cache them locally.
  if ($locations === NULL) {
    $locations = backup_migrate_crud_get_items('location');
  }

  // Return all if that's what was asked for.
  if ($op == 'all') {
    return $locations;
  }

  // Return only those locations which support the given op.
  $out = array();
  if ($locations) {
    foreach ($locations as $key => $location) {
      if ($location
        ->op($op)) {
        $out[$key] = $location;
      }
    }
  }
  return $out;
}