summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapplication/config/example/config.php1
-rw-r--r--application/controllers/user.php14
2 files changed, 15 insertions, 0 deletions
diff --git a/application/config/example/config.php b/application/config/example/config.php
index bd9ec40aa..000af65fc 100755
--- a/application/config/example/config.php
+++ b/application/config/example/config.php
@@ -375,6 +375,7 @@ $config['upload_max_text_size'] = 2*1024*1024;
// 0 disables deletion
$config['upload_max_age'] = 60*60*24*5; // 5 days
+$config['invitations_max_age'] = 60*60*24*5; // 5 days
// won't be deleted
$config['small_upload_size'] = 1024*10; // 10KB
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));
+ }
}