From aa83596b0bec71af8d96ee346d7a625709bf0750 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 10 Nov 2012 12:13:53 +0100 Subject: Clarify keep-alive setting, move it to User Interface section, change label to "Refresh (check for new messages, etc.)", allow no-refresh mode. --- config/main.inc.php.dist | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'config/main.inc.php.dist') diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index dafee72f1..64312b6a9 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -241,7 +241,6 @@ $rcmail_config['skin_include_php'] = false; $rcmail_config['display_version'] = false; // Session lifetime in minutes -// must be greater than 'keep_alive'/60 $rcmail_config['session_lifetime'] = 10; // Session domain: .example.org @@ -500,7 +499,6 @@ $rcmail_config['recipients_separator'] = ','; $rcmail_config['max_pagesize'] = 200; // Minimal value of user's 'keep_alive' setting (in seconds) -// Must be less than 'session_lifetime' $rcmail_config['min_keep_alive'] = 60; // Enables files upload indicator. Requires APC installed and enabled apc.rfc1867 option. @@ -780,8 +778,9 @@ $rcmail_config['read_when_deleted'] = true; // Use 'Purge' to remove messages marked as deleted $rcmail_config['flag_for_deletion'] = false; -// Default interval for keep-alive/check-recent requests (in seconds) -// Must be greater than or equal to 'min_keep_alive' and less than 'session_lifetime' +// Default interval for auto-refresh requests (in seconds) +// These are requests for system state updates e.g. checking for new messages, etc. +// Setting it to 0 disables the feature. $rcmail_config['keep_alive'] = 60; // If true all folders will be checked for recent messages -- cgit v1.2.3 From f226549d4f8f258deca9e165ef857252b79d2ee0 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 12 Nov 2012 14:50:49 +0100 Subject: Renamed config options: keep_alive to refresh_interval, min_keep_alive to min_refresh_interval --- CHANGELOG | 1 + config/main.inc.php.dist | 6 +++--- installer/rcube_install.php | 3 --- program/include/rcmail.php | 4 ++-- program/include/rcube_config.php | 2 ++ program/js/app.js | 5 ++--- program/steps/settings/func.inc | 16 ++++++++-------- program/steps/settings/save_prefs.inc | 8 ++++---- 8 files changed, 22 insertions(+), 23 deletions(-) (limited to 'config/main.inc.php.dist') diff --git a/CHANGELOG b/CHANGELOG index 6c50340cc..d0473c675 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ CHANGELOG Roundcube Webmail - Improved keep-alive action. Now the interval is based on session_lifetime (#1488507) - Added cross-task 'refresh' request for system state updates (#1488507) +- Renamed config options: keep_alive to refresh_interval, min_keep_alive to min_refresh_interval - Fix AREA links handling (#1488792) - Better client-side timezone detection using the jsTimezoneDetect library (#1488725) - Fix possible HTTP DoS on error in keep-alive requests (#1488782) diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist index 64312b6a9..1b7ae5a54 100644 --- a/config/main.inc.php.dist +++ b/config/main.inc.php.dist @@ -498,8 +498,8 @@ $rcmail_config['recipients_separator'] = ','; // don't let users set pagesize to more than this value if set $rcmail_config['max_pagesize'] = 200; -// Minimal value of user's 'keep_alive' setting (in seconds) -$rcmail_config['min_keep_alive'] = 60; +// Minimal value of user's 'refresh_interval' setting (in seconds) +$rcmail_config['min_refresh_interval'] = 60; // Enables files upload indicator. Requires APC installed and enabled apc.rfc1867 option. // By default refresh time is set to 1 second. You can set this value to true @@ -781,7 +781,7 @@ $rcmail_config['flag_for_deletion'] = false; // Default interval for auto-refresh requests (in seconds) // These are requests for system state updates e.g. checking for new messages, etc. // Setting it to 0 disables the feature. -$rcmail_config['keep_alive'] = 60; +$rcmail_config['refresh_interval'] = 60; // If true all folders will be checked for recent messages $rcmail_config['check_all_folders'] = false; diff --git a/installer/rcube_install.php b/installer/rcube_install.php index d1dce9d0e..06c57c0ac 100644 --- a/installer/rcube_install.php +++ b/installer/rcube_install.php @@ -342,9 +342,6 @@ class rcube_install } } - if ($current['keep_alive'] && $current['session_lifetime'] < $current['keep_alive']) - $current['session_lifetime'] = max(10, ceil($current['keep_alive'] / 60) * 2); - $this->config = array_merge($this->config, $current); foreach ((array)$current['ldap_public'] as $key => $values) { diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 04b87e48c..99a68e81d 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -317,8 +317,8 @@ class rcmail extends rcube if (!($this->output instanceof rcube_output_html)) $this->output = new rcube_output_html($this->task, $framed); - // set keep-alive interval - $this->output->set_env('keep_alive', $this->config->get('keep_alive', 0)); + // set refresh interval + $this->output->set_env('refresh_interval', $this->config->get('refresh_interval', 0)); $this->output->set_env('session_lifetime', $this->config->get('session_lifetime', 0) * 60); if ($framed) { diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php index 1f165ba4a..bbc3e9c6e 100644 --- a/program/include/rcube_config.php +++ b/program/include/rcube_config.php @@ -43,6 +43,8 @@ class rcube_config 'mail_pagesize' => 'pagesize', 'addressbook_pagesize' => 'pagesize', 'reply_mode' => 'top_posting', + 'refresh_interval' => 'keep_alive', + 'min_refresh_interval' => 'min_keep_alive', ); diff --git a/program/js/app.js b/program/js/app.js index 25fddf10c..fb9c299ec 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -44,7 +44,6 @@ function rcube_webmail() this.identifier_expr = new RegExp('[^0-9a-z\-_]', 'gi'); // default environment vars - this.env.keep_alive = 60; // seconds this.env.request_timeout = 180; // seconds this.env.draft_autosave = 0; // seconds this.env.comm_path = './'; @@ -6488,13 +6487,13 @@ function rcube_webmail() // starts interval for refresh signal this.start_refresh = function() { - if (!this.env.keep_alive || this.env.framed || this.env.extwin || this.task == 'login' || this.env.action == 'print') + if (!this.env.refresh_interval || this.env.framed || this.env.extwin || this.task == 'login' || this.env.action == 'print') return; if (this._refresh) clearInterval(this._refresh); - this._refresh = setInterval(function(){ ref.refresh(); }, this.env.keep_alive * 1000); + this._refresh = setInterval(function(){ ref.refresh(); }, this.env.refresh_interval * 1000); }; // sends keep-alive signal diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 27e1e1346..876e02761 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -237,21 +237,21 @@ function rcmail_user_prefs($current=null) ); } - if (!isset($no_override['keep_alive'])) { - $field_id = 'rcmfd_keep_alive'; - $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); + if (!isset($no_override['refresh_interval'])) { + $field_id = 'rcmfd_refresh_interval'; + $select_refresh_interval = new html_select(array('name' => '_refresh_interval', 'id' => $field_id)); - $select_keep_alive->add(rcube_label('never'), 0); + $select_refresh_interval->add(rcube_label('never'), 0); foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) { - if (!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) { + if (!$config['min_refresh_interval'] || $config['min_refresh_interval'] <= $min * 60) { $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))); - $select_keep_alive->add($label, $min); + $select_refresh_interval->add($label, $min); } } - $blocks['main']['options']['keep_alive'] = array( + $blocks['main']['options']['refresh_interval'] = array( 'title' => html::label($field_id, Q(rcube_label('refreshinterval'))), - 'content' => $select_keep_alive->show($config['keep_alive']/60), + 'content' => $select_refresh_interval->show($config['refresh_interval']/60), ); } diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index 2f22be7c4..5daab0d24 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -33,7 +33,7 @@ switch ($CURR_SECTION) 'date_format' => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'], 'time_format' => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'), 'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE, - 'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'], + 'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'], 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'], ); @@ -157,9 +157,9 @@ switch ($CURR_SECTION) $a_user_prefs['timezone'] = (string) $a_user_prefs['timezone']; - if (isset($a_user_prefs['keep_alive']) && !empty($CONFIG['min_keep_alive'])) { - if ($a_user_prefs['keep_alive'] > $CONFIG['min_keep_alive']) { - $a_user_prefs['keep_alive'] = $CONFIG['min_keep_alive']; + if (isset($a_user_prefs['refresh_interval']) && !empty($CONFIG['min_refresh_interval'])) { + if ($a_user_prefs['refresh_interval'] > $CONFIG['min_refresh_interval']) { + $a_user_prefs['refresh_interval'] = $CONFIG['min_refresh_interval']; } } -- cgit v1.2.3