[TASK] Remove ses_name from tables fe_sessions and be_sessions 21/51821/12
authorThomas Hohn <thomas@hohn.dk>
Fri, 24 Feb 2017 09:10:55 +0000 (10:10 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 26 Feb 2017 22:05:59 +0000 (23:05 +0100)
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>
components/testing_framework/Resources/Core/Acceptance/Fixtures/be_sessions.xml
typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php
typo3/sysext/core/Tests/Functional/Session/Backend/DatabaseSessionBackendTest.php
typo3/sysext/core/Tests/Functional/Session/Backend/RedisSessionBackendTest.php
typo3/sysext/core/ext_tables.sql
typo3/sysext/frontend/Tests/Unit/Authentication/FrontendUserAuthenticationTest.php
typo3/sysext/frontend/ext_tables.sql

index ea0ce28..e744814 100644 (file)
@@ -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>
index 5812b3b..af392b8 100644 (file)
@@ -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 {
index b8fb261..423316d 100644 (file)
@@ -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));
     }
 }
index 4a83ba7..721acf0 100644 (file)
@@ -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));
     }
 }
index 8319c9b..cfe5f81 100644 (file)
@@ -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)
 );
 
index b0032bb..f72d749 100644 (file)
@@ -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']),
index df809c1..594207c 100644 (file)
@@ -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;