From c3c7c401a342d3436845d197ce1848688e4f96c2 Mon Sep 17 00:00:00 2001 From: Thomas Hohn <thomas@hohn.dk> Date: Fri, 24 Feb 2017 10:10:55 +0100 Subject: [PATCH] [TASK] Remove ses_name from tables fe_sessions and be_sessions Both fe_session and be_session table currently have a combined primary key on ses_id / ses_name which is not needed by the new session framework. In addition the field ses_name is dropped. Resolves: #79720 Releases: master Change-Id: I4827d4ebfa0e04a303fca21ae865c99188d1a81a Reviewed-on: https://review.typo3.org/51821 Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Resources/Core/Acceptance/Fixtures/be_sessions.xml | 2 -- .../Classes/Authentication/AbstractUserAuthentication.php | 3 +-- .../Session/Backend/DatabaseSessionBackendTest.php | 5 ++--- .../Functional/Session/Backend/RedisSessionBackendTest.php | 5 ++--- typo3/sysext/core/ext_tables.sql | 3 +-- .../Unit/Authentication/FrontendUserAuthenticationTest.php | 2 -- typo3/sysext/frontend/ext_tables.sql | 3 +-- 7 files changed, 7 insertions(+), 16 deletions(-) diff --git a/components/testing_framework/Resources/Core/Acceptance/Fixtures/be_sessions.xml b/components/testing_framework/Resources/Core/Acceptance/Fixtures/be_sessions.xml index ea0ce289e0a6..e74481492019 100644 --- a/components/testing_framework/Resources/Core/Acceptance/Fixtures/be_sessions.xml +++ b/components/testing_framework/Resources/Core/Acceptance/Fixtures/be_sessions.xml @@ -2,7 +2,6 @@ <dataset> <be_sessions> <ses_id>886526ce72b86870739cc41991144ec1</ses_id> - <ses_name>be_typo_user</ses_name> <ses_iplock>[DISABLED]</ses_iplock> <ses_userid>1</ses_userid> <ses_tstamp>1777777777</ses_tstamp> @@ -11,7 +10,6 @@ </be_sessions> <be_sessions> <ses_id>ff83dfd81e20b34c27d3e97771a4525a</ses_id> - <ses_name>be_typo_user</ses_name> <ses_iplock>[DISABLED]</ses_iplock> <ses_userid>2</ses_userid> <ses_tstamp>1777777777</ses_tstamp> diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index 5812b3b0280d..af392b8ab985 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -942,7 +942,6 @@ abstract class AbstractUserAuthentication return [ 'ses_id' => $this->id, - 'ses_name' => $this->name, 'ses_iplock' => $sessionIpLock, 'ses_userid' => $tempuser[$this->userid_column] ?? 0, 'ses_tstamp' => $GLOBALS['EXEC_TIME'], @@ -998,7 +997,7 @@ abstract class AbstractUserAuthentication $sessionUpdateGracePeriod = 61; if (!$skipSessionUpdate && $GLOBALS['EXEC_TIME'] > ($userRecord['ses_tstamp'] + $sessionUpdateGracePeriod)) { // Update the session timestamp by writing a dummy update. (Backend will update the timestamp) - $updatesSession = $this->getSessionBackend()->update($this->id, ['ses_name' => $userRecord['ses_name']]); + $updatesSession = $this->getSessionBackend()->update($this->id, []); $userRecord = array_merge($userRecord, $updatesSession); } } else { diff --git a/typo3/sysext/core/Tests/Functional/Session/Backend/DatabaseSessionBackendTest.php b/typo3/sysext/core/Tests/Functional/Session/Backend/DatabaseSessionBackendTest.php index b8fb26165344..423316dd1332 100644 --- a/typo3/sysext/core/Tests/Functional/Session/Backend/DatabaseSessionBackendTest.php +++ b/typo3/sysext/core/Tests/Functional/Session/Backend/DatabaseSessionBackendTest.php @@ -35,7 +35,6 @@ class DatabaseSessionBackendTest extends FunctionalTestCase */ protected $testSessionRecord = [ 'ses_id' => 'randomSessionId', - 'ses_name' => 'session_name', 'ses_userid' => 1, // serialize(['foo' => 'bar', 'boo' => 'far']) 'ses_data' => 'a:2:{s:3:"foo";s:3:"bar";s:3:"boo";s:3:"far";}', @@ -234,11 +233,11 @@ class DatabaseSessionBackendTest extends FunctionalTestCase { $updatedRecord = array_merge( $this->testSessionRecord, - ['ses_name' => 'newSessionName', 'ses_tstamp' => $GLOBALS['EXEC_TIME']] + ['ses_tstamp' => $GLOBALS['EXEC_TIME']] ); $sessionId = 'randomSessionId'; $this->subject->set($sessionId, $this->testSessionRecord); - $this->subject->update($sessionId, ['ses_name' => 'newSessionName']); + $this->subject->update($sessionId, []); $this->assertArraySubset($updatedRecord, $this->subject->get($sessionId)); } } diff --git a/typo3/sysext/core/Tests/Functional/Session/Backend/RedisSessionBackendTest.php b/typo3/sysext/core/Tests/Functional/Session/Backend/RedisSessionBackendTest.php index 4a83ba7407f6..721acf0efe60 100644 --- a/typo3/sysext/core/Tests/Functional/Session/Backend/RedisSessionBackendTest.php +++ b/typo3/sysext/core/Tests/Functional/Session/Backend/RedisSessionBackendTest.php @@ -36,7 +36,6 @@ class RedisSessionBackendTest extends FunctionalTestCase */ protected $testSessionRecord = [ 'ses_id' => 'randomSessionId', - 'ses_name' => 'session_name', 'ses_userid' => 1, // serialize(['foo' => 'bar', 'boo' => 'far']) 'ses_data' => 'a:2:{s:3:"foo";s:3:"bar";s:3:"boo";s:3:"far";}', @@ -264,11 +263,11 @@ class RedisSessionBackendTest extends FunctionalTestCase { $updatedRecord = array_merge( $this->testSessionRecord, - ['ses_name' => 'newSessionName', 'ses_tstamp' => $GLOBALS['EXEC_TIME']] + ['ses_tstamp' => $GLOBALS['EXEC_TIME']] ); $sessionId = 'randomSessionId'; $this->subject->set($sessionId, $this->testSessionRecord); - $this->subject->update($sessionId, ['ses_name' => 'newSessionName']); + $this->subject->update($sessionId, []); $this->assertArraySubset($updatedRecord, $this->subject->get($sessionId)); } } diff --git a/typo3/sysext/core/ext_tables.sql b/typo3/sysext/core/ext_tables.sql index 8319c9b8f426..cfe5f81f25df 100644 --- a/typo3/sysext/core/ext_tables.sql +++ b/typo3/sysext/core/ext_tables.sql @@ -37,13 +37,12 @@ CREATE TABLE be_groups ( # CREATE TABLE be_sessions ( ses_id varchar(32) DEFAULT '' NOT NULL, - ses_name varchar(100) DEFAULT '' NOT NULL, ses_iplock varchar(39) DEFAULT '' NOT NULL, ses_userid int(11) unsigned DEFAULT '0' NOT NULL, ses_tstamp int(11) unsigned DEFAULT '0' NOT NULL, ses_data longblob, ses_backuserid int(11) NOT NULL default '0', - PRIMARY KEY (ses_id,ses_name), + PRIMARY KEY (ses_id), KEY ses_tstamp (ses_tstamp) ); diff --git a/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php b/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php index b0032bbc0648..f72d749c5bc8 100644 --- a/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php +++ b/typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php @@ -233,7 +233,6 @@ class FrontendUserAuthenticationTest extends UnitTestCase 'newSessionId', [ 'ses_id' => 'newSessionId', - 'ses_name' => 'fe_typo_user', 'ses_iplock' => '', 'ses_userid' => 0, 'ses_tstamp' => $currentTime, @@ -290,7 +289,6 @@ class FrontendUserAuthenticationTest extends UnitTestCase [ 'ses_id' => $uniqueSessionId, 'ses_userid' => 1, - 'ses_name' => 'fe_typo_user', 'ses_iplock' => '[DISABLED]', 'ses_tstamp' => $currentTime, 'ses_data' => serialize(['foo' => 'bar']), diff --git a/typo3/sysext/frontend/ext_tables.sql b/typo3/sysext/frontend/ext_tables.sql index df809c119a0c..594207cf1613 100644 --- a/typo3/sysext/frontend/ext_tables.sql +++ b/typo3/sysext/frontend/ext_tables.sql @@ -50,7 +50,6 @@ CREATE TABLE fe_groups ( # CREATE TABLE fe_sessions ( ses_id varchar(32) DEFAULT '' NOT NULL, - ses_name varchar(100) DEFAULT '' NOT NULL, ses_iplock varchar(39) DEFAULT '' NOT NULL, ses_userid int(11) unsigned DEFAULT '0' NOT NULL, ses_tstamp int(11) unsigned DEFAULT '0' NOT NULL, @@ -58,7 +57,7 @@ CREATE TABLE fe_sessions ( ses_permanent tinyint(1) unsigned DEFAULT '0' NOT NULL, ses_anonymous tinyint(1) unsigned DEFAULT '0' NOT NULL, - PRIMARY KEY (ses_id,ses_name), + PRIMARY KEY (ses_id), KEY ses_tstamp (ses_tstamp) ) ENGINE=InnoDB; -- GitLab