mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:37:02 +02:00
added the webui to the tarball
This commit is contained in:
43
webui/model/stat/counter.php
Normal file
43
webui/model/stat/counter.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
class ModelStatCounter extends Model {
|
||||
|
||||
public function getCounters(){
|
||||
$counter = array();
|
||||
|
||||
if(MEMCACHED_ENABLED) {
|
||||
$memcache = Registry::get('memcache');
|
||||
|
||||
$counter = $memcache->get(Registry::get('counters'));
|
||||
|
||||
if(isset($counter['_c:counters_last_update'])) { return $counter; }
|
||||
}
|
||||
|
||||
$query = $this->db->query("SELECT * FROM " . TABLE_COUNTER);
|
||||
|
||||
if($query->num_rows == 1) {
|
||||
$counter = $query->row;
|
||||
}
|
||||
|
||||
return $counter;
|
||||
}
|
||||
|
||||
|
||||
public function resetCounters(){
|
||||
|
||||
if(MEMCACHED_ENABLED) {
|
||||
$memcache = Registry::get('memcache');
|
||||
|
||||
foreach (Registry::get('counters') as $counter) {
|
||||
$memcache->set($counter, 0);
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->db->query("UPDATE " . TABLE_COUNTER . " set rcvd=0, virus=0, duplicate=0, ignore=0");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user