Reset default db_max_allowed_packet, fix max packet size detection

pull/280/head
Aleksander Machniak 10 years ago
parent f985cbedc6
commit ab84cc15e5

@ -55,7 +55,7 @@ $config['db_table_dsn'] = array(
// Use them if your server is not MySQL or for better performance. // Use them if your server is not MySQL or for better performance.
// For example Roundcube uses max_allowed_packet value (in bytes) // For example Roundcube uses max_allowed_packet value (in bytes)
// which limits query size for database cache operations. // which limits query size for database cache operations.
$config['db_max_allowed_packet'] = 23423440; $config['db_max_allowed_packet'] = null;
// ---------------------------------- // ----------------------------------

@ -605,8 +605,10 @@ class rcube_cache
$this->max_packet = 2097152; // default/max is 2 MB $this->max_packet = 2097152; // default/max is 2 MB
if ($this->type == 'db') { if ($this->type == 'db') {
$value = $this->db->get_variable('max_allowed_packet', $this->max_packet); if ($value = $this->db->get_variable('max_allowed_packet', $this->max_packet)) {
$this->max_packet = max($value, $this->max_packet) - 2000; $this->max_packet = $value;
}
$this->max_packet -= 2000;
} }
else if ($this->type == 'memcache') { else if ($this->type == 'memcache') {
$stats = $this->db->getStats(); $stats = $this->db->getStats();

@ -595,8 +595,10 @@ class rcube_cache_shared
$this->max_packet = 2097152; // default/max is 2 MB $this->max_packet = 2097152; // default/max is 2 MB
if ($this->type == 'db') { if ($this->type == 'db') {
$value = $this->db->get_variable('max_allowed_packet', 1048500); if ($value = $this->db->get_variable('max_allowed_packet', $this->max_packet)) {
$this->max_packet = min($value, $this->max_packet) - 2000; $this->max_packet = $value;
}
$this->max_packet -= 2000;
} }
else if ($this->type == 'memcache') { else if ($this->type == 'memcache') {
$stats = $this->db->getStats(); $stats = $this->db->getStats();

Loading…
Cancel
Save