diff --git a/src/config.h b/src/config.h index e25000ed..952406cf 100644 --- a/src/config.h +++ b/src/config.h @@ -43,18 +43,18 @@ #define CRLF "\n" -#define MEMCACHED_CLAPF_PREFIX "_piler" +#define MEMCACHED_CLAPF_PREFIX "_piler:" #define MAX_MEMCACHED_KEY_LEN 250 #define MEMCACHED_SUCCESS 0 #define MEMCACHED_FAILURE 1 -#define MEMCACHED_COUNTERS_LAST_UPDATE MEMCACHED_CLAPF_PREFIX ":counters_last_update" -#define MEMCACHED_MSGS_RCVD MEMCACHED_CLAPF_PREFIX ":rcvd" -#define MEMCACHED_MSGS_VIRUS MEMCACHED_CLAPF_PREFIX ":virus" -#define MEMCACHED_MSGS_DUPLICATE MEMCACHED_CLAPF_PREFIX ":duplicate" -#define MEMCACHED_MSGS_IGNORE MEMCACHED_CLAPF_PREFIX ":ignore" -#define MEMCACHED_MSGS_SIZE MEMCACHED_CLAPF_PREFIX ":size" +#define MEMCACHED_COUNTERS_LAST_UPDATE MEMCACHED_CLAPF_PREFIX "counters_last_update" +#define MEMCACHED_MSGS_RCVD MEMCACHED_CLAPF_PREFIX "rcvd" +#define MEMCACHED_MSGS_VIRUS MEMCACHED_CLAPF_PREFIX "virus" +#define MEMCACHED_MSGS_DUPLICATE MEMCACHED_CLAPF_PREFIX "duplicate" +#define MEMCACHED_MSGS_IGNORE MEMCACHED_CLAPF_PREFIX "ignore" +#define MEMCACHED_MSGS_SIZE MEMCACHED_CLAPF_PREFIX "size" #define LOG_PRIORITY LOG_INFO diff --git a/webui/config.php b/webui/config.php index 3d565256..8d52b4a7 100644 --- a/webui/config.php +++ b/webui/config.php @@ -143,14 +143,14 @@ define('MIN_PASSWORD_LENGTH', 6); define('CGI_INPUT_FIELD_WIDTH', 50); define('CGI_INPUT_FIELD_HEIGHT', 7); -define('MEMCACHED_PREFIX', '_piler_webui:'); +define('MEMCACHED_PREFIX', '_piler:'); define('MEMCACHED_TTL', 3600); $memcached_servers = array( array('127.0.0.1', 11211) ); -$counters = array('_piler:rcvd', '_piler:virus', '_piler:duplicate', '_piler:ignore', '_piler:counters_last_update'); +$counters = array(MEMCACHED_PREFIX . 'rcvd', MEMCACHED_PREFIX . 'virus', MEMCACHED_PREFIX . 'duplicate', MEMCACHED_PREFIX . 'ignore', MEMCACHED_PREFIX . 'counters_last_update'); $health_smtp_servers = array( array(PILER_HOST, PILER_PORT, "piler"), array(SMARTHOST, SMARTHOST_PORT, "smarthost") ); diff --git a/webui/controller/health/worker.php b/webui/controller/health/worker.php index 1fb846e1..fc677bbf 100644 --- a/webui/controller/health/worker.php +++ b/webui/controller/health/worker.php @@ -31,32 +31,17 @@ class ControllerHealthWorker extends Controller { } - /*$this->data['queues'][] = format_qshape($lang->data['text_active_incoming_queue'], QSHAPE_ACTIVE_INCOMING); - $this->data['queues'][] = format_qshape($lang->data['text_deferred_queue'], QSHAPE_DEFERRED);*/ - - /*if(file_exists(QSHAPE_ACTIVE_INCOMING_OUT)) { - $this->data['queues_out'][] = format_qshape($lang->data['text_active_incoming_queue'], QSHAPE_ACTIVE_INCOMING_OUT); - $this->data['queues_out'][] = format_qshape($lang->data['text_deferred_queue'], QSHAPE_DEFERRED_OUT); - }*/ - $this->data['processed_emails'] = $this->model_health_health->count_processed_emails(); list ($this->data['uptime'], $this->data['cpuload']) = $this->model_health_health->uptime(); $this->data['cpuinfo'] = 100 - (int)file_get_contents(CPUSTAT); - $this->data['archive_size'] = (int)file_get_contents(ARCHIVE_SIZE); $this->data['quarantinereportinfo'] = @file_get_contents(DAILY_QUARANTINE_REPORT_STAT); list($this->data['totalmem'], $this->data['meminfo'], $this->data['totalswap'], $this->data['swapinfo']) = $this->model_health_health->meminfo(); $this->data['shortdiskinfo'] = $this->model_health_health->diskinfo(); - /*if(file_exists(MAILLOG_PID_FILE)) { - $this->data['maillog_status'] = $lang->data['text_running']; - } else { - $this->data['maillog_status'] = $lang->data['text_not_running']; - }*/ - if(ENABLE_LDAP_IMPORT_FEATURE == 1) { $this->data['adsyncinfo'] = @file_get_contents(AD_SYNC_STAT); @@ -86,9 +71,10 @@ class ControllerHealthWorker extends Controller { } - $this->data['counters'] = $this->model_stat_counter->getCounters(); + list($this->data['archive_size'], $this->data['counters']) = $this->model_stat_counter->getCounters(); + $this->data['prefix'] = ''; - if(isset($this->data['counters']['_c:rcvd'])) { $this->data['prefix'] = '_c:'; } + if(isset($this->data['counters'][MEMCACHED_PREFIX . 'rcvd'])) { $this->data['prefix'] = MEMCACHED_PREFIX; } $this->data['sysinfo'] = $this->model_health_health->sysinfo(); diff --git a/webui/model/stat/counter.php b/webui/model/stat/counter.php index 41241f38..a3e4d26a 100644 --- a/webui/model/stat/counter.php +++ b/webui/model/stat/counter.php @@ -4,22 +4,31 @@ class ModelStatCounter extends Model { public function getCounters(){ $counter = array(); + $asize = 0; if(MEMCACHED_ENABLED) { $memcache = Registry::get('memcache'); $counter = $memcache->get(Registry::get('counters')); - if(isset($counter['_c:counters_last_update'])) { return $counter; } + if(isset($counter[MEMCACHED_PREFIX . 'counters_last_update'])) { + $asize = nice_size($counter[MEMCACHED_PREFIX . 'size'], ' '); + unset($counter[MEMCACHED_PREFIX . 'size']); + + return array ($asize, $counter); + } } $query = $this->db->query("SELECT * FROM " . TABLE_COUNTER); if($query->num_rows == 1) { + $asize = nice_size($query->row['size'], ' '); + unset($query->row['size']); + $counter = $query->row; } - return $counter; + return array ($asize, $counter); } diff --git a/webui/model/user/user.php b/webui/model/user/user.php index de66856e..c5d20a47 100644 --- a/webui/model/user/user.php +++ b/webui/model/user/user.php @@ -297,7 +297,7 @@ class ModelUserUser extends Model { if(MEMCACHED_ENABLED) { $memcache = Registry::get('memcache'); - $memcache->delete("_c:" . $email); + $memcache->delete(MEMCACHED_PREFIX . $email); } if($query->row['count'] > 0) { @@ -394,7 +394,7 @@ class ModelUserUser extends Model { if(MEMCACHED_ENABLED) { $memcache = Registry::get('memcache'); - $memcache->delete("_c:" . $email); + $memcache->delete(MEMCACHED_PREFIX . $email); } } diff --git a/webui/view/theme/default/templates/health/worker.tpl b/webui/view/theme/default/templates/health/worker.tpl index de77466e..9b6cfcaa 100644 --- a/webui/view/theme/default/templates/health/worker.tpl +++ b/webui/view/theme/default/templates/health/worker.tpl @@ -24,7 +24,7 @@
-
- : sec - -: - -: - -: - -: MB - -: // - - - - -: %, : - -: % / MB, : % / MB - -: % - -: - -- |
-
-
-:- - - -
:- - - -
|
-