]> git.joonet.de Git - adminer.git/commitdiff
Remove DEFINER from CREATE VIEW (bug #3041130)
authorJakub Vrana <jakub@vrana.cz>
Wed, 11 Aug 2010 15:14:07 +0000 (17:14 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 11 Aug 2010 15:14:07 +0000 (17:14 +0200)
adminer/include/export.inc.php

index 74d6c8b423b86907f4dbdde9c05a4a7a2efdbebb..052ab9757f5f2f334bb50d8c11b9cc2beb775597 100644 (file)
@@ -22,6 +22,10 @@ function dump_table($table, $style, $is_view = false) {
                        if ($style == "DROP+CREATE") {
                                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";
                }
                if ($style == "CREATE+ALTER" && !$is_view) {