function drush_sql_dump_file

6.x sql.drush.inc drush_sql_dump_file(&$site_record)
3.x sql.drush.inc drush_sql_dump_file(&$db_spec)
4.x sql.drush.inc drush_sql_dump_file(&$db_spec, $prefix)
5.x sql.drush.inc drush_sql_dump_file(&$site_record)

Determine where to store an sql dump file. This function is called by sql-sync if the caller did not explicitly specify a dump file to use.

Parameters

db_spec: Information about the database being dumped; used to generate the filename.

Return value

string The path to the dump file

1 call to drush_sql_dump_file()
_drush_sql_sync in commands/sql/sync.sql.inc

File

commands/sql/sql.drush.inc, line 485
Drush sql commands

Code

function drush_sql_dump_file(&$db_spec) {
  // Make a base filename pattern to use to name the dump file
  $filename_pattern = $db_spec['database'];
  if (isset($db_spec['remote-host'])) {
    $filename_pattern = $db_spec['remote-host'] . '_' . $filename_pattern;
  }
  // If the user has set the --dump-dir option, then
  // store persistant sql dump files there.
  $dump_dir = drush_get_option(array('source-dump-dir', 'dump-dir'));
  if (isset($dump_dir)) {
    $dump_file = $dump_dir . '/' . $filename_pattern . '.sql';
  }
  // If the --dump-dir option is not set, then store
  // the sql dump in a temporary file.
  else {
    $dump_file = drush_tempnam($filename_pattern . '.sql.');
    $db_spec['dump-is-temp'] = TRUE;
  }

  return $dump_file;
}