foreveralone

foreveralone Commit Details


Date:2016-02-27 14:37:26 (9 years 1 month ago)
Author:Natalie Adams
Branch:master
Commit:f7928b101429ee42b6c7c916f8bec14a97f61b7f
Parents: 92b3b492d36233b339b0472bd6e8bd5b1b108869
Message:Issue 127: Implement session cleanup

Changes:

File differences

web/application/controllers/base.php
5959
6060
6161
62
63
64
65
66
67
68
69
70
71
72
73
74
75
6276
77
78
79
80
6381
6482
6583
    {
        parent::__construct($config, $core, $tpl);
        $core->setupDatabaseConnection();
        $expiredSessions = \vendor\DB\DB::fetchObject("SELECT * FROM sessions WHERE lastPing <= ?", "\application\models\Sessions", [time() - 20]);
        /** @var \application\models\Sessions $session */
        foreach($expiredSessions as $session) {
            if ($session->to_user) {
                /** @var \application\models\Sessions $otherSession */
                $otherSession = \application\models\Sessions::getByField("id", $session->to_user);
                $otherSession->waiting = true;
                $otherSession->to_user = null;
                $otherSession->save();
            }
            $session->delete();
        }
        $this->setupSession();
        if ($this->session) {
            $this->session->lastPing = time();
            $this->session->save();
        }
        if (isset($_POST["csrfmiddlewaretoken"])) {
            if ($_POST["csrfmiddlewaretoken"] != $_COOKIE["csrftoken"]) {

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.24911s using 20 queries.