From: Tim Düsterhus Date: Fri, 25 Mar 2016 19:58:33 +0000 (+0100) Subject: Move sessionVariables into virtual session X-Git-Tag: 3.0.0_Beta_1~1968^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=34c95e168ea32f282b213ae9e6677ced086f52ff;p=GitHub%2FWoltLab%2FWCF.git Move sessionVariables into virtual session --- diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 6d5489d1be..6352dda2d1 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -386,7 +386,7 @@ class SessionHandler extends SingletonFactory { * Initializes session variables. */ protected function loadVariables() { - @$this->variables = unserialize($this->session->sessionVariables); + @$this->variables = unserialize($this->virtualSession->sessionVariables); if (!is_array($this->variables)) { $this->variables = array(); } @@ -839,7 +839,7 @@ class SessionHandler extends SingletonFactory { $this->session = $session; // inherit security token - $variables = @unserialize($this->session->sessionVariables); + $variables = @unserialize($this->virtualSession->sessionVariables); if (is_array($variables) && !empty($variables['__SECURITY_TOKEN'])) { $this->register('__SECURITY_TOKEN', $variables['__SECURITY_TOKEN']); } @@ -873,9 +873,6 @@ class SessionHandler extends SingletonFactory { $data['objectType'] = RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->getObjectType(); $data['objectID'] = RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->getObjectID(); } - if ($this->variablesChanged) { - $data['sessionVariables'] = serialize($this->variables); - } // update session /** @var \wcf\data\DatabaseObjectEditor $sessionEditor */ @@ -890,6 +887,12 @@ class SessionHandler extends SingletonFactory { $virtualSessionEditor = new SessionVirtualEditor($this->virtualSession); } $virtualSessionEditor->updateLastActivityTime(); + + $data = []; + if ($this->variablesChanged) { + $data['sessionVariables'] = serialize($this->variables); + } + $virtualSessionEditor->update($data); } } diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 383938ae78..9339d25f8d 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -74,8 +74,7 @@ CREATE TABLE wcf1_acp_session ( parentObjectType VARCHAR(255) NOT NULL DEFAULT '', parentObjectID INT(10) NOT NULL DEFAULT 0, objectType VARCHAR(255) NOT NULL DEFAULT '', - objectID INT(10) NOT NULL DEFAULT 0, - sessionVariables MEDIUMTEXT + objectID INT(10) NOT NULL DEFAULT 0 ); DROP TABLE IF EXISTS wcf1_acp_session_access_log; @@ -110,6 +109,7 @@ CREATE TABLE wcf1_acp_session_virtual ( ipAddress VARCHAR(39) NOT NULL DEFAULT '', userAgent VARCHAR(255) NOT NULL DEFAULT '', lastActivityTime INT(10) NOT NULL DEFAULT 0, + sessionVariables MEDIUMTEXT, UNIQUE KEY (sessionID, ipAddress, userAgent) ); @@ -1074,7 +1074,6 @@ CREATE TABLE wcf1_session ( parentObjectID INT(10) NOT NULL DEFAULT 0, objectType VARCHAR(255) NOT NULL DEFAULT '', objectID INT(10) NOT NULL DEFAULT 0, - sessionVariables MEDIUMTEXT, spiderID INT(10), KEY packageID (lastActivityTime, spiderID), UNIQUE KEY uniqueUserID (userID) @@ -1087,6 +1086,7 @@ CREATE TABLE wcf1_session_virtual ( ipAddress VARCHAR(39) NOT NULL DEFAULT '', userAgent VARCHAR(255) NOT NULL DEFAULT '', lastActivityTime INT(10) NOT NULL DEFAULT 0, + sessionVariables MEDIUMTEXT, UNIQUE KEY (sessionID, ipAddress, userAgent) );