Fix Restore databases from Backup & Migrate module with Autoclave module Drupal
Fix Restore databases from Backup & Migrate module with Autoclave module Drupal
In file: /sites/all/modules/third-party/backup_migrate/includes/sources.db.mysql.inc
/**
* Backup the databases to a file.
*/
function _restore_db_from_file($file, $settings) {
$num = 0;
#++
include_once("/var/www/html/drupal/includes/database/autoslave/database.inc");
#--
// if ($file->open() && $conn = $this->_get_db_connection()) {
#++
if ($file->open() && $conn = $this->_get_db_connection()->getMasterConnection()) {
// Read one line at a time and run the query.
while ($line = $this->_read_sql_command_from_file($file)) {
if (_backup_migrate_check_timeout()) {
return FALSE;
}
if ($line) {
// Prepeare and exexute the statement instead of the api function to avoid substitution of '{' etc.
$stmt = $conn->prepare($line);
$stmt->execute();
$num++;
}
}
// Close the file with fclose/gzclose.
$file->close();
}
else {
drupal_set_message(t("Unable to open file %file to restore database", array("%file" => $file->filepath())), 'error');
$num = FALSE;
}
return $num;
}
Post a Comment