aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cron_tasks/standard/tidy_sessions.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/cron_tasks/standard/tidy_sessions.php')
-rw-r--r--phpBB/includes/cron_tasks/standard/tidy_sessions.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/phpBB/includes/cron_tasks/standard/tidy_sessions.php b/phpBB/includes/cron_tasks/standard/tidy_sessions.php
new file mode 100644
index 0000000000..6ff2dee14b
--- /dev/null
+++ b/phpBB/includes/cron_tasks/standard/tidy_sessions.php
@@ -0,0 +1,44 @@
+<?php
+/**
+*
+* @package phpBB3
+* @version $Id$
+* @copyright (c) 2010 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Tidy sessions cron task.
+*
+* @package phpBB3
+*/
+class tidy_sessions_cron_task extends cron_task_base
+{
+ /**
+ * Runs this cron task.
+ */
+ public function run()
+ {
+ global $user;
+ $user->session_gc();
+ }
+
+ /**
+ * Returns whether this cron task should run now, because enough time
+ * has passed since it was last run.
+ */
+ public function should_run()
+ {
+ global $config;
+ return $config['session_last_gc'] < time() - $config['session_gc'];
+ }
+}