function drush_tempnam

8.0.x filesystem.inc drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '')
6.x filesystem.inc drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '')
7.x filesystem.inc drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '')
3.x drush.inc drush_tempnam($pattern, $tmp_dir = NULL)
4.x drush.inc drush_tempnam($pattern, $tmp_dir = NULL)
5.x filesystem.inc drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '')
master filesystem.inc drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '')

Creates a temporary file, and registers it so that it will be deleted when drush exits. Whenever possible, drush_save_data_to_temp_file() should be used instead of this function.

2 calls to drush_tempnam()
drush_sql_dump_file in commands/sql/sql.drush.inc
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.
_drush_sql_sync in commands/sql/sync.sql.inc

File

includes/drush.inc, line 452
The drush API implementation and helpers.

Code

function drush_tempnam($pattern, $tmp_dir = NULL) {
  if ($tmp_dir == NULL) {
    $tmp_dir = sys_get_temp_dir();
  }
  $tmp_file = tempnam($tmp_dir, $pattern);
  drush_register_file_for_deletion($tmp_file);

  return $tmp_file;
}