function drush_sync_via_http_pre_sql_sync

8.0.x sync_via_http.drush.inc drush_sync_via_http_pre_sql_sync($source = NULL, $destination = NULL)
6.x sync_via_http.drush.inc drush_sync_via_http_pre_sql_sync($source = NULL, $destination = NULL)
7.x sync_via_http.drush.inc drush_sync_via_http_pre_sql_sync($source = NULL, $destination = NULL)
5.x sync_via_http.drush.inc drush_sync_via_http_pre_sql_sync($source = NULL, $destination = NULL)
master sync_via_http.drush.inc drush_sync_via_http_pre_sql_sync($source = NULL, $destination = NULL)

Implement hook pre sql sync.

During the pre hook, determine if the http-sync option has been specified. If it has been, then disable the normal ssh + rsync dump-and-transfer that sql-sync usually does, and transfer the database dump via an http download.

File

examples/sync_via_http.drush.inc, line 64

Code

function drush_sync_via_http_pre_sql_sync($source = NULL, $destination = NULL) {
  $sql_dump_download_url = drush_get_option('http-sync');
  if (!empty($sql_dump_download_url)) {
    $user = drush_get_option('http-sync-user', FALSE);
    $password = drush_get_option('http-sync-password', FALSE);
    $source_dump_file = _drush_sync_via_http_download_file($sql_dump_download_url, $user, $password);
    if ($source_dump_file === FALSE) {
      return drush_set_error('DRUSH_CANNOT_DOWNLOAD', dt("The URL !url could not be downloaded.", array('!url' => $sql_dump_download_url)));
    }
    drush_set_option('target-dump', $source_dump_file);
    drush_set_option('no-dump', TRUE);
    drush_set_option('no-sync', TRUE);
  }
}