/**
  * Write session data
  *
  * @param	string		session id
  * @param	string		session data
  */
 static function _writeData($a_session_id, $a_data)
 {
     global $ilDB, $ilClientIniFile;
     if ($GLOBALS['WEB_ACCESS_WITHOUT_SESSION']) {
         // Prevent session data written for web access checker
         // when no cookie was sent (e.g. for pdf files linking others).
         // This would result in new session records for each request.
         return false;
     }
     $now = time();
     // prepare session data
     $fields = array("user_id" => array("integer", (int) $_SESSION["AccountId"]), "expires" => array("integer", self::getExpireValue()), "data" => array("clob", $a_data), "ctime" => array("integer", $now), "type" => array("integer", (int) $_SESSION["SessionType"]));
     if ($ilClientIniFile->readVariable("session", "save_ip")) {
         $fields["remote_addr"] = array("text", $_SERVER["REMOTE_ADDR"]);
     }
     if (ilSession::_exists($a_session_id)) {
         $ilDB->update("usr_session", $fields, array("session_id" => array("text", $a_session_id)));
     } else {
         $fields["session_id"] = array("text", $a_session_id);
         $fields["createtime"] = array("integer", $now);
         $ilDB->insert("usr_session", $fields);
         // check type against session control
         $type = $fields["type"][1];
         if (in_array($type, ilSessionControl::$session_types_controlled)) {
             ilSessionStatistics::createRawEntry($fields["session_id"][1], $type, $fields["createtime"][1], $fields["user_id"][1]);
         }
     }
     // finally delete deprecated sessions
     if (rand(0, 50) == 2) {
         // get time _before_ destroying expired sessions
         self::_destroyExpiredSessions();
         ilSessionStatistics::aggretateRaw($now);
     }
     return true;
 }
 protected function adminSync()
 {
     global $ilCtrl, $lng;
     // see ilSession::_writeData()
     $now = time();
     ilSession::_destroyExpiredSessions();
     ilSessionStatistics::aggretateRaw($now);
     ilUtil::sendSuccess($lng->txt("trac_sync_session_stats_success"), true);
     $ilCtrl->redirect($this);
 }