From: Jakub Vrana Date: Tue, 22 Mar 2011 14:12:38 +0000 (+0100) Subject: Avoid big ternary (save memory) X-Git-Tag: v3.2.1~6 X-Git-Url: https://git.joonet.de/?a=commitdiff_plain;h=0bc930c52af0a65080465065f41a995bd7bab0e6;p=adminer.git Avoid big ternary (save memory) --- diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 449bdc12..0a3ae17d 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -408,10 +408,10 @@ username.form['driver'].onchange(); restart_session(); $id = "sql-" . ($count++); $history = &get_session("queries"); - $history[$_GET["db"]][] = (strlen($query) > 1e6 // not DB - reset in drop database - ? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment - : $query - ); //! respect $_GET["ns"] + if (strlen($query) > 1e6) { // not DB - reset in drop database + $query = ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..."; // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment + } + $history[$_GET["db"]][] = $query; //! respect $_GET["ns"] return " " . lang('SQL command') . "'; }