Clean out the viewers table every 5 minutes.
This commit is contained in:
parent
035ed81542
commit
d79162a889
2 changed files with 14 additions and 1 deletions
|
@ -1,10 +1,17 @@
|
|||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class View extends CI_Controller {
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->load->model('viewer');
|
||||
$this->viewer->clean_viewers(5 * 60);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function specific() {
|
||||
$this->load->model('fileupload');
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@ class Viewer extends CI_Model {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function clean_viewers($duration) {
|
||||
$clean_time = time() - $duration;
|
||||
|
||||
$this->db->query("DELETE FROM viewers WHERE timestamp < $clean_time");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in a new issue