function backup_migrate_destination_db::restore_from_file in Backup and Migrate 7.2
Same name and namespace in other branches
- 8.2 includes/destinations.db.inc \backup_migrate_destination_db::restore_from_file()
- 8.3 includes/destinations.db.inc \backup_migrate_destination_db::restore_from_file()
- 6.2 includes/destinations.db.inc \backup_migrate_destination_db::restore_from_file()
- 7.3 includes/destinations.db.inc \backup_migrate_destination_db::restore_from_file()
Restore to this source.
File
- includes/
destinations.db.inc, line 164 - Functions to handle the direct to database destination.
Class
- backup_migrate_destination_db
- A destination type for saving to a database server.
Code
function restore_from_file($file, &$settings) {
$num = 0;
$type = $this
->get_file_type_id();
// Open the file using the file wrapper. Check that the dump is of the right type (allow .sql for legacy reasons).
if ($file
->type_id() !== $this
->get_file_type_id() && $file
->type_id() !== 'sql') {
_backup_migrate_message("Unable to restore from file %file because a %type file can't be restored to this database.", array(
"%file" => $file
->filepath(),
'%type' => $file
->type_id(),
), 'error');
}
else {
backup_migrate_filters_invoke_all('pre_restore', $file, $settings);
// Restore the database.
$num = $this
->_restore_db_from_file($file, $settings);
$settings->performed_action = $num ? t('%num SQL commands executed.', array(
'%num' => $num,
)) : '';
backup_migrate_filters_invoke_all('post_restore', $file, $settings, $num);
}
return $num;
}