Hi guys,
can you provide in nest relase a function like this?
/**
* Import SQL file
* @return TRUE on success, else FALSE
* @param string $filepath
* @param string $open_func
* @param string $read_func
* @param string $close_func
*/
function _sp_backup_execute_sql($filepath, $open_func, $read_func, $close_func) {
if ($handle = @$open_func($filepath, "r")) {
$num = 0;
// Read one line at a time and run the query.
while ($line = $read_func($handle)) {
$line = trim($line);
if ($line) {
// Use the helper instead of the api function to avoid substitution of '{' etc.
_db_query($line);
$num++;
}
}
// Close the file with fclose/gzclose.
$close_func($handle);
return TRUE;
}
return FALSE;
}
And use it inside _backup_migrate_restore_file function?
I've write a module that use backup_migrate and i need a function to import SQL that return true or false.
TNX a lot
Comments
Comment #1
coreykck commentedPerhaps, return $num is better than TRUE :)
Comment #2
ronan commentedNot sure I understand what's going on here, but if you want me to add some functionality please reopen and move to the 2.x branch