diff --git a/IntelliSenseHelper.php b/IntelliSenseHelper.php new file mode 100644 index 0000000..8b6f094 --- /dev/null +++ b/IntelliSenseHelper.php @@ -0,0 +1,20 @@ + + * @link https://www.oxidmodule.com + */ + +namespace D3\SidCookieFix\modules\core { + + use OxidEsales\Eshop\Core\Session; + + class Session_sidcookiefix_parent extends Session {} +} + \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/setup+doku/installation.txt b/README.md similarity index 69% rename from setup+doku/installation.txt rename to README.md index b8543a5..00ed033 100644 --- a/setup+doku/installation.txt +++ b/README.md @@ -1,16 +1,28 @@ +# SID Cookie Fix + Dieses Bugfix verhindert das mehrfache Setzen des Session-ID-Cookies und der damit verbundenden Vergrößerung der Headerzeilen jeder geladenen Ressource. Dies führt bei manchen LoadBalancer-Konfigurationen zu Verbindungsabbrüchen. +## Wichtig! + Bitte beachten Sie: Eingriffe in das Session- und Cookie-Handling können tiefgreifende Auswirkungen auf den Shopbetrieb haben. Wir stellen diese Erweiterung ohne Gewährleistung zur Verfügung. Testen Sie dies vor einem produktiven Einsatz unbedingt umfangreich. Der Einsatz dieses Moduls erfolgt auf eigenes Risiko. -Dieses Modul ist einsetzbar im OXID eShop ab Version 4.3.2 bis 4.10.3 / 5.3.3. Davon +## Anforderungen + +Dieses Modul ist einsetzbar im OXID eShop ab Version 6.2. Davon abweichende Shopversionen wurden damit nicht kontrolliert. -Kopieren Sie den Inhalt des "copy_this"-Ordners in den Root-Ordner Ihres Shops. +## Installation + +``` +composer config repositories.d3sidcookiefix vcs https://git.d3data.de/D3Public/SidCookieFix.git +composer require d3/sidcookiefix +``` + Aktivieren Sie das Modul "D3 Session ID Cookie fix" im Adminbereich unter "Erweiterungen -> Module". \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..2c4b029 --- /dev/null +++ b/composer.json @@ -0,0 +1,46 @@ +{ + "name": "d3/sidcookiefix", + "description": "verhindert das mehrfache Setzen des Session-ID-Cookies und der damit verbundenden Vergrößerung der Headerzeilen jeder geladenen Ressource", + "type": "oxideshop-module", + "keywords": [ + "oxid", + "modules", + "eShop", + "d3" + ], + "authors": [ + { + "name": "D3 Data Development (Inh. Thomas Dartsch)", + "email": "info@shopmodule.com", + "homepage": "https://www.d3data.de", + "role": "Owner" + } + ], + "support": { + "email": "support@shopmodule.com" + }, + "homepage": "https://www.oxidmodule.com/", + "license": [ + "GPL-3.0-or-later" + ], + "require": { + "oxid-esales/oxideshop-ce": "^6.5" + }, + "extra": { + "oxideshop": { + "blacklist-filter": [ + "*.md", + "composer.json", + ".php-cs-fixer.php", + "*.xml", + "*.neon" + ], + "target-directory": "d3/sidcookiefix" + } + }, + "autoload": { + "psr-4": { + "D3\\SidCookieFix\\": "../../../source/modules/d3/sidcookiefix" + } + } +} diff --git a/copy_this/modules/d3/sidcookiefix/metadata.php b/copy_this/modules/d3/sidcookiefix/metadata.php deleted file mode 100644 index 7191152..0000000 --- a/copy_this/modules/d3/sidcookiefix/metadata.php +++ /dev/null @@ -1,34 +0,0 @@ -getD3Logo() : 'D³'); - -/** - * Module information - */ -$aModule = array( - 'id' => 'd3sidcookiefix', - 'title' => $sD3Logo . ' Session ID Cookie fix', - 'description' => array( - 'de' => '', - 'en' => '' - ), - 'thumbnail' => 'picture.png', - 'version' => '2.0.0.0', - 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', - 'email' => 'support@shopmodule.com', - 'url' => 'http://www.oxidmodule.com/', - 'extend' => array( - OxidEsales\Eshop\Core\Session::class => 'd3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession', - ), - 'files' => array(), - 'templates' => array(), - 'events' => array(), - 'blocks' => array(), - 'settings' => array(), -); diff --git a/copy_this/modules/d3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php b/copy_this/modules/d3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php deleted file mode 100644 index 5a7ae4b..0000000 --- a/copy_this/modules/d3/sidcookiefix/modules/core/d3_sidcookiefix_oxsession.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @link http://www.oxidmodule.com - */ - -class d3_sidcookiefix_oxsession extends d3_sidcookiefix_oxsession_parent -{ - protected function _setSessionId($sSessId) - { - //marking this session as new one, as it might be not writen to db yet - if ($sSessId && session_id() != $sSessId) { - $this->_blNewSession = true; - } - - session_id($sSessId); - - $this->setId($sSessId); - - $blUseCookies = $this->_getSessionUseCookies(); - - if (!$this->_allowSessionStart()) { - if ($blUseCookies) { - oxRegistry::get("oxUtilsServer")->setOxCookie($this->getName(), null); - } - - return; - } - - if ($blUseCookies) { - // D3: check for set SessionCookie - $sCookieSessid = oxRegistry::get("oxUtilsServer")->getOxCookie($this->getName()); - if (!$sCookieSessid || $sSessId != $sCookieSessid) { - //setting session cookie - oxRegistry::get("oxUtilsServer")->setOxCookie($this->getName(), $sSessId); - } - } - } -} \ No newline at end of file diff --git a/metadata.php b/metadata.php new file mode 100644 index 0000000..2c5e8d4 --- /dev/null +++ b/metadata.php @@ -0,0 +1,31 @@ +'; + +$aModule = [ + 'id' => 'd3sidcookiefix', + 'title' => $logo . ' Session ID Cookie fix', + 'description' => [ + 'de' => '', + 'en' => '' + ], + 'thumbnail' => 'picture.png', + 'version' => '3.0.0.0', + 'author' => 'D³ Data Development (Inh.: Thomas Dartsch)', + 'email' => 'support@shopmodule.com', + 'url' => 'https://www.oxidmodule.com/', + 'extend' => [ + Session::class => Session_sidcookiefix::class, + ], + 'templates' => [], + 'events' => [], + 'blocks' => [], + 'settings' => [], +]; diff --git a/modules/core/Session_sidcookiefix.php b/modules/core/Session_sidcookiefix.php new file mode 100644 index 0000000..24b98e3 --- /dev/null +++ b/modules/core/Session_sidcookiefix.php @@ -0,0 +1,35 @@ + + * @link https://www.oxidmodule.com + */ + +declare(strict_types=1); + +namespace D3\SidCookieFix\modules\core; + +use OxidEsales\Eshop\Core\Registry; + +class Session_sidcookiefix extends Session_sidcookiefix_parent +{ + protected function setSessionCookie($sessionId): void + { + if ($this->_getSessionUseCookies()) { + if (!$this->_allowSessionStart()) { + Registry::getUtilsServer()->setOxCookie($this->getName(), null); + } else { + $sCookieSessid = Registry::getUtilsServer()->getOxCookie($this->getName()); + if (!$sCookieSessid || $sessionId != $sCookieSessid) { + Registry::getUtilsServer()->setOxCookie( $this->getName(), $sessionId ); + } + } + } + } +} \ No newline at end of file diff --git a/copy_this/modules/d3/sidcookiefix/picture.png b/picture.png similarity index 100% rename from copy_this/modules/d3/sidcookiefix/picture.png rename to picture.png