You are here

function _backup_migrate_save_to_disk in Backup and Migrate 5

Same name and namespace in other branches
  1. 6 backup_migrate.module \_backup_migrate_save_to_disk()

Save the backup file to the appropriete folder on the server.

2 calls to _backup_migrate_save_to_disk()
BackupMigrateUnitTest::testSaveToDisk in tests/BackupMigrateUnitTest.test
_backup_migrate_dump_tables in ./backup_migrate.module
Build the database dump file. Takes a list of tables to exclude and some formatting options.

File

./backup_migrate.module, line 897
Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (f.e. cache_*)

Code

function _backup_migrate_save_to_disk($temp_file, $filename, $mode = "manual") {
  if ($dir = _backup_migrate_check_destination_dir($mode)) {
    $filepath = $dir . "/" . $filename;
    rename($temp_file, $filepath);
    $message = t('Database backup saved to %file. ', array(
      '%file' => $filepath,
    ));
    watchdog('backup_migrate', $message);
    if ($mode == "manual" && user_access('perform backup')) {
      $message .= user_access("access backup files") ? "(" . l(t("Download"), "system/files/" . $filepath) . ") " : "";
      $message .= user_access("delete backup files") ? "(" . l(t("Delete..."), "admin/content/backup_migrate/delete/" . $filepath) . ") " : "";
      $message .= user_access("restore from backup") ? "(" . l(t("Restore..."), "admin/content/backup_migrate/restorefile/" . $filepath) . ")" : "";
      drupal_set_message($message);
    }
  }
}