You are here

function backup_migrate_backup_migrate_destinations in Backup and Migrate 6.2

Same name and namespace in other branches
  1. 8.2 includes/destinations.inc \backup_migrate_backup_migrate_destinations()
  2. 8.3 includes/destinations.inc \backup_migrate_backup_migrate_destinations()
  3. 5.2 includes/destinations.inc \backup_migrate_backup_migrate_destinations()
  4. 6.3 includes/destinations.inc \backup_migrate_backup_migrate_destinations()
  5. 7.3 includes/destinations.inc \backup_migrate_backup_migrate_destinations()
  6. 7.2 includes/destinations.inc \backup_migrate_backup_migrate_destinations()

Implementation of hook_backup_migrate_destinations().

Get the built in backup destinations and those in the db.

File

includes/destinations.inc, line 116

Code

function backup_migrate_backup_migrate_destinations() {
  $out = array();

  // Add the default, out of the box destinations for new users.
  if (variable_get('backup_migrate_allow_backup_to_file', TRUE)) {
    $out['manual'] = backup_migrate_create_destination('file_manual', array(
      'destination_id' => 'manual',
    ));
    $out['scheduled'] = backup_migrate_create_destination('file_scheduled', array(
      'destination_id' => 'scheduled',
    ));
  }

  // Add the browser destination for downloading to the desktop.
  if (variable_get('backup_migrate_allow_backup_to_download', TRUE)) {
    $out['download'] = backup_migrate_create_destination('browser_download');
  }
  $out['upload'] = backup_migrate_create_destination('browser_upload');
  if ($secret_key = variable_get('nodesquirrel_secret_key', '')) {
    $out['nodesquirrel'] = backup_migrate_create_destination('nodesquirrel', array(
      'destination_id' => 'nodesquirrel',
    ));
    $out['nodesquirrel']->settings['secret_key'] = $secret_key;
  }

  // Expose the configured databases as sources.
  backup_migrate_include('filters');
  $out += backup_migrate_filters_invoke_all('destinations');

  /*
    global $db_url;
    $urls = is_array($db_url) ? $db_url : array('default' => $db_url);
    foreach ((array)$urls as $key => $url) {
      // Only mysql is currently supported. If more DBMs's are implemented, theis will need to be abstacted.
      if (strpos($url, 'mysql') === 0) {
        if ($destination = backup_migrate_create_destination('mysql', array('url' => $url))) {
          // Treat the default database differently because it is probably the only one available.
          if ($key == 'default') {
            $destination->set_id('db');
            $destination->set_name(t('Default Database'));
            // Dissalow backing up to the default database because that's confusing and potentially dangerous.
            unset($destination->supported_ops['scheduled backup']);
            unset($destination->supported_ops['manual backup']);
          }
          else {
            $destination->set_id('db:'. $key);
            $destination->set_name($key .": ". $destination->get_display_location());
          }
          $out[$destination->get_id()] = $destination;
        }
      }
    }
  */
  return $out;
}