You are here

function backup_migrate_db_backup in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 5.2 includes/db.inc \backup_migrate_db_backup()

Build the database dump file. Takes a list of tables to exclude and some formatting options.

File

includes/db.inc, line 44
General database dump/restore code for Backup and Migrate.

Code

function backup_migrate_db_backup($source, $file, $settings) {
  $success = FALSE;
  if ($type = _backup_migrate_db_get_db_type($source->dest_url['scheme'])) {
    $file
      ->push_type($type);

    // Switch to a different db if specified.
    _backup_migrate_db_switch_db($source
      ->get_location());
    backup_migrate_filters_invoke_all('pre_backup', $source, $file, $settings);

    // Dump the database.
    $function = 'backup_migrate_backup_db_to_file_' . $type;
    if (function_exists($function)) {
      $success = $function($file, $settings);
    }
    backup_migrate_filters_invoke_all('post_backup', $source, $file, $settings, $success);

    // Switch back to the previous db.
    _backup_migrate_db_switch_db();
  }
  return $success ? $file : FALSE;
}