At least in MySQL, the Backup and Migrate module completely ignores database query errors when it tries to restore. In one case, I had a problem where it unzipped a gzipped archive that was corrupted, attempted to run about 2000+ queries, and they all failed. But the module still reported that it had successfully restored my database.
When I looked in the dblog, it showed me that there were 2000+ errors.
This is the code from 6.x that needs to be updated (it's in includes/destinations.db.mysql.inc in method _restore_db_from_file()):
$line = trim($line);
if ($line) {
// Use the helper instead of the api function to avoid substitution of '{' etc.
_db_query($line);
$num++;
}
It should be something more like this:
$line = trim($line);
if ($line) {
// Use the helper instead of the api function to avoid substitution of '{' etc.
if (!_db_query($line)) {
trigger_error(check_plain("Database error running query " . $line));
return FALSE;
}
$num++;
}
}
It looks as though 7.x would have the same problem, since the corresponding code (same exact function name in same file) just runs ->execute() on the query line, and doesn't check for any errors, as far as I can tell.
Comments
Comment #1
ronan commentedAgreed. I'll work on this next chance I get.
Comment #2
couturier commentedCan anyone verify if @ronan has fixed this with the release of 7.x-3.2?
Comment #3
couturier commentedClosing after more than two weeks with no activity.
Comment #4
ivnish