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

coreykck’s picture

Title: Separated import sql function » Separated import sql function (ops)

Perhaps, return $num is better than TRUE :)

ronan’s picture

Status: Active » Closed (won't fix)

Not 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