function backup_migrate_perform_restore_file in Backup and Migrate 5.2
Restore from a file in the given destination.
2 calls to backup_migrate_perform_restore_file()
- backup_migrate_destination_db_save in includes/
destinations.db.inc - Databse save download destination callback.
- backup_migrate_perform_restore in ./
backup_migrate.module - Restore from a file in the given destination.
File
- ./
backup_migrate.module, line 615 - Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (e.g. cache_*)
Code
function backup_migrate_perform_restore_file($file) {
require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/files.inc';
require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/db.inc';
// If not in 'safe mode', increase the maximum execution time:
if (!ini_get('safe_mode') && ini_get('max_execution_time') < 600) {
set_time_limit(600);
}
$filename = $file['filename'];
if ($file) {
$file = backup_migrate_file_decompress($file);
}
if ($file) {
$num = backup_migrate_db_restore($file);
}
$destination = backup_migrate_get_destination($destination_id);
$message = 'Database restored from %destination file %file. %num SQL commands executed.';
if ($destination && in_array('list files', $destination['ops'])) {
$message .= ' (<a href="!restoreurl">Restore again...</a>)';
}
_backup_migrate_message($message, array(
"%destination" => $destination['name'],
"%num" => $num,
'%file' => $filename,
'!restoreurl' => url('admin/content/backup_migrate/destination/restorefile/' . $destination_id . "/" . $file_id),
));
// Delete any temp files we've created.
backup_migrate_temp_file("", TRUE);
return $file;
}