You are here

function backup_migrate_temp_directory in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.3 includes/files.inc \backup_migrate_temp_directory()
  2. 7.3 includes/files.inc \backup_migrate_temp_directory()

Create a temporary directory.

7 calls to backup_migrate_temp_directory()
backup_migrate_destination_filesource::_backup_to_file_cli in includes/sources.filesource.inc
Backup from this source.
backup_migrate_destination_filesource::_restore_from_file_cli in includes/sources.filesource.inc
Restore to this source.
backup_migrate_destination_filesource::_restore_from_file_php in includes/sources.filesource.inc
Restore to this source.
backup_migrate_files_destination_archivesource::generate_manifest in includes/sources.archivesource.inc
Generate a manifest file.
backup_migrate_files_destination_archivesource::get_db in includes/sources.archivesource.inc
Get a database dump to add to the archive.

... See full list

File

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

Code

function backup_migrate_temp_directory() {
  $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_');
  mkdir($file);
  backup_migrate_temp_files_add($file);
  return $file;
}