mirror of
https://github.com/vrana/adminer.git
synced 2025-08-24 15:12:51 +02:00
Remove DEFINER from CREATE VIEW (bug #3041130)
This commit is contained in:
@@ -22,6 +22,10 @@ function dump_table($table, $style, $is_view = false) {
|
|||||||
if ($style == "DROP+CREATE") {
|
if ($style == "DROP+CREATE") {
|
||||||
echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
|
echo "DROP " . ($is_view ? "VIEW" : "TABLE") . " IF EXISTS " . table($table) . ";\n";
|
||||||
}
|
}
|
||||||
|
if ($is_view) {
|
||||||
|
// remove DEFINER with current user
|
||||||
|
$create = preg_replace('~^([A-Z =]+) DEFINER=`' . str_replace("@", "`@`", logged_user()) . '`~', '\\1', $create); //! proper escaping of user
|
||||||
|
}
|
||||||
echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n";
|
echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n";
|
||||||
}
|
}
|
||||||
if ($style == "CREATE+ALTER" && !$is_view) {
|
if ($style == "CREATE+ALTER" && !$is_view) {
|
||||||
|
Reference in New Issue
Block a user