mirror of
https://github.com/webmin/webmin.git
synced 2026-05-04 22:30:33 +01:00
Use the 'source' command to read in sql files, as it's more reliable that simply redirecting input https://www.virtualmin.com/node/53763
This commit is contained in:
@@ -979,8 +979,13 @@ local ($db, $file, $user, $pass) = @_;
|
||||
local $authstr = &make_authstr($user, $pass);
|
||||
local $cs = $sql_charset ? "--default-character-set=".quotemeta($sql_charset)
|
||||
: "";
|
||||
local $temp = &transname();
|
||||
&open_tempfile(TEMP, ">$temp");
|
||||
&print_tempfile(TEMP, "source ".$file.";\n");
|
||||
&close_tempfile(TEMP);
|
||||
&set_ownership_permissions(undef, undef, 0644, $temp);
|
||||
local $cmd = "$config{'mysql'} $authstr -t ".quotemeta($db)." ".$cs.
|
||||
" <".quotemeta($file);
|
||||
" <".quotemeta($temp);
|
||||
-r $file || return (1, "$file does not exist");
|
||||
if ($_[4] && $_[4] ne 'root' && $< == 0) {
|
||||
# Restoring as a Unix user
|
||||
|
||||
Reference in New Issue
Block a user