diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_db_mysql.php | 19 |
2 files changed, 15 insertions, 5 deletions
@@ -9,6 +9,7 @@ CHANGELOG Roundcube Webmail - Fix setting max packet size for DB caches and check packet size also in shared cache - Fix needless security warning on BMP attachments display (#1490282) - Fix handling of some improper constructs in format=flowed text as per the RFC3676[4.5] (#1490284) +- Fix performance of rcube_db_mysql::get_variable() RELEASE 1.1.0 ------------- diff --git a/program/lib/Roundcube/rcube_db_mysql.php b/program/lib/Roundcube/rcube_db_mysql.php index 0e85b0f9c..067e94be6 100644 --- a/program/lib/Roundcube/rcube_db_mysql.php +++ b/program/lib/Roundcube/rcube_db_mysql.php @@ -161,15 +161,24 @@ class rcube_db_mysql extends rcube_db { if (!isset($this->variables)) { $this->variables = array(); + } - $result = $this->query('SHOW VARIABLES'); + if (array_key_exists($varname, $this->variables)) { + return $this->variables[$varname]; + } - while ($row = $this->fetch_array($result)) { - $this->variables[$row[0]] = $row[1]; - } + $result = $this->query('SHOW VARIABLES LIKE ?', $varname); + + while ($row = $this->fetch_array($result)) { + $this->variables[$row[0]] = $row[1]; + } + + // not found, use default + if (!isset($this->variables[$varname])) { + $this->variables[$varname] = $default; } - return isset($this->variables[$varname]) ? $this->variables[$varname] : $default; + return $this->variables[$varname]; } /** |