function drush_tempnam
| 6.x filesystem.inc | drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '') |
| 5.x filesystem.inc | drush_tempnam($pattern, $tmp_dir = NULL, |
| 3.x drush.inc | drush_tempnam($pattern, $tmp_dir = NULL) |
| 4.x drush.inc | drush_tempnam($pattern, $tmp_dir = NULL) |
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.
Parameters
string suffix: Append this suffix to the filename. Use of this parameter is discouraged as it can break the guarantee of tempname(). See http://www.php.net/manual/en/function.tempnam.php#42052. Originally added to support Oracle driver.
Related topics
11 calls to drush_tempnam()
- drush_docs_errorcodes in commands/
core/ docs.drush.inc - docs-error-codes command. Print a list of all error codes that can be found.
- drush_pm_updatecode in commands/
pm/ updatecode.pm.inc - Command callback. Displays update status info and allows to update installed projects. Pass specific projects as arguments, otherwise we update all that have candidate releases.
- drush_print_file in includes/
output.inc - Print the contents of a file.
- drush_save_data_to_temp_file in includes/
filesystem.inc - Save a string to a temporary file. Does not depend on Drupal's API. The temporary file will be automatically deleted when drush exits.
- 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.
File
- includes/
filesystem.inc, line 457
Code
function drush_tempnam($pattern, $tmp_dir = NULL, $suffix = '') {
if ($tmp_dir == NULL) {
$tmp_dir = drush_find_tmp();
}
$tmp_file = tempnam($tmp_dir, $pattern);
drush_register_file_for_deletion($tmp_file);
return $tmp_file . $suffix;
}