示例#1
0
 /**
  * GC session handler.
  *
  * {@see http://php.net/manual/en/function.session-set-save-handler.php}
  *
  * @param int $ignored_maxlifetime moodle uses special timeout rules
  * @return bool success
  */
 public function handler_gc($ignored_maxlifetime)
 {
     // This should do something only if cron is not running properly...
     if (!($stalelifetime = ini_get('session.gc_maxlifetime'))) {
         return true;
     }
     $params = array('purgebefore' => time() - $stalelifetime);
     $this->database->delete_records_select('sessions', 'userid = 0 AND timemodified < :purgebefore', $params);
     return true;
 }