summaryrefslogtreecommitdiffstats
path: root/application/controllers/user.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-07-12 14:30:36 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-07-12 14:30:36 +0200
commit9455292feec751d799d93b1c2b790ea47e9f6f52 (patch)
tree5211ac47801a8c47b474f706f9c6b26fec1a3d89 /application/controllers/user.php
parent1eb6508517a670667c8d69b1fe3d6a6beaab7451 (diff)
Add cron function for user controller
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/user.php')
-rw-r--r--application/controllers/user.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/application/controllers/user.php b/application/controllers/user.php
index 3b6570a91..add6e8bdc 100644
--- a/application/controllers/user.php
+++ b/application/controllers/user.php
@@ -216,4 +216,18 @@ class User extends CI_Controller {
$this->load->view($this->var->view_dir.'hash_password', $this->data);
$this->load->view($this->var->view_dir.'footer', $this->data);
}
+
+ function cron()
+ {
+ if (!$this->input->is_cli_request()) return;
+
+ if ($this->config->item('invitations_max_age') == 0) return;
+
+ $oldest_time = (time() - $this->config->item('invitations_max_age'));
+
+ $this->db->query("
+ DELETE FROM invitations
+ WHERE date < ?
+ ", array($oldest_time));
+ }
}