You are here

function backup_file::temporary_file in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.2 includes/files.inc \backup_file::temporary_file()
  2. 8.3 includes/files.inc \backup_file::temporary_file()
  3. 6.2 includes/files.inc \backup_file::temporary_file()
  4. 7.3 includes/files.inc \backup_file::temporary_file()
  5. 7.2 includes/files.inc \backup_file::temporary_file()

Get a temporary file name with path.

3 calls to backup_file::temporary_file()
backup_file::backup_file in includes/files.inc
Construct a file object given a file path, or create a temp file for writing.
backup_file::pop_type in includes/files.inc
Push a file extension onto the file and return the previous file path.
backup_file::push_type in includes/files.inc
Push a file extension onto the file and return the previous file path.

File

includes/files.inc, line 544
General file handling code for Backup and Migrate.

Class

backup_file
A backup file which allows for saving to and reading from the server.

Code

function temporary_file() {
  $tmp = realpath(file_directory_temp());

  // Check the writability of the temp directory.
  if (!is_writable(realpath(file_directory_temp()))) {
    _backup_migrate_message('Your temporary directory %tmp is not writable. Backup and migrate needs to be able to create temporary files.', array(
      '%tmp' => $tmp,
    ), 'error');
  }

  // Use a full path so that the files can be deleted during the shutdown function if needed.
  $file = $tmp . '/' . uniqid('backup_migrate_');
  $file .= '.' . $this
    ->extension();
  backup_migrate_temp_files_add($file);
  $this->path = $file;
}