refactor for OXID 6.2 and up
This commit is contained in:
parent
93975f532b
commit
d4f0fff666
20
IntelliSenseHelper.php
Normal file
20
IntelliSenseHelper.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* https://www.d3data.de
|
||||||
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
|
* @link https://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace D3\SidCookieFix\modules\core {
|
||||||
|
|
||||||
|
use OxidEsales\Eshop\Core\Session;
|
||||||
|
|
||||||
|
class Session_sidcookiefix_parent extends Session {}
|
||||||
|
}
|
||||||
|
|
@ -1,16 +1,28 @@
|
|||||||
|
# SID Cookie Fix
|
||||||
|
|
||||||
Dieses Bugfix verhindert das mehrfache Setzen des Session-ID-Cookies und der damit
|
Dieses Bugfix verhindert das mehrfache Setzen des Session-ID-Cookies und der damit
|
||||||
verbundenden Vergrößerung der Headerzeilen jeder geladenen Ressource.
|
verbundenden Vergrößerung der Headerzeilen jeder geladenen Ressource.
|
||||||
|
|
||||||
Dies führt bei manchen LoadBalancer-Konfigurationen zu Verbindungsabbrüchen.
|
Dies führt bei manchen LoadBalancer-Konfigurationen zu Verbindungsabbrüchen.
|
||||||
|
|
||||||
|
## Wichtig!
|
||||||
|
|
||||||
Bitte beachten Sie: Eingriffe in das Session- und Cookie-Handling können tiefgreifende
|
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
|
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
|
zur Verfügung. Testen Sie dies vor einem produktiven Einsatz unbedingt umfangreich. Der
|
||||||
Einsatz dieses Moduls erfolgt auf eigenes Risiko.
|
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.
|
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 ->
|
Aktivieren Sie das Modul "D3 Session ID Cookie fix" im Adminbereich unter "Erweiterungen ->
|
||||||
Module".
|
Module".
|
46
composer.json
Normal file
46
composer.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Metadata version
|
|
||||||
*/
|
|
||||||
$sMetadataVersion = '1.1';
|
|
||||||
|
|
||||||
$sD3Logo = (class_exists(d3\modcfg\Application\Model\d3utils::class) ? d3\modcfg\Application\Model\d3utils::getInstance()->getD3Logo() : 'D³');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module information
|
|
||||||
*/
|
|
||||||
$aModule = array(
|
|
||||||
'id' => 'd3sidcookiefix',
|
|
||||||
'title' => $sD3Logo . ' Session ID Cookie fix',
|
|
||||||
'description' => array(
|
|
||||||
'de' => '<ul><li>fix multiple session cookie header lines </li>'
|
|
||||||
.'<li>causes "Connection reset by peer" errors </li>'
|
|
||||||
.'<li>error occur in some load balancer configurations because of to long headers</li></ul>',
|
|
||||||
'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(),
|
|
||||||
);
|
|
@ -1,50 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This Software is the property of Data Development and is protected
|
|
||||||
* by copyright law - it is NOT Freeware.
|
|
||||||
*
|
|
||||||
* Any unauthorized use of this software without a valid license
|
|
||||||
* is a violation of the license agreement and will be prosecuted by
|
|
||||||
* civil and criminal law.
|
|
||||||
*
|
|
||||||
* http://www.shopmodule.com
|
|
||||||
*
|
|
||||||
* @copyright © D³ Data Development, Thomas Dartsch
|
|
||||||
* @author D³ Data Development - Daniel Seifert <support@shopmodule.com>
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
31
metadata.php
Normal file
31
metadata.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use D3\SidCookieFix\modules\core\Session_sidcookiefix;
|
||||||
|
use OxidEsales\Eshop\Core\Session;
|
||||||
|
|
||||||
|
$sMetadataVersion = '2.1';
|
||||||
|
|
||||||
|
$logo = '<img src="https://logos.oxidmodule.com/d3logo_individual.svg" alt="(D3)" style="height:1em;width:1em">';
|
||||||
|
|
||||||
|
$aModule = [
|
||||||
|
'id' => 'd3sidcookiefix',
|
||||||
|
'title' => $logo . ' Session ID Cookie fix',
|
||||||
|
'description' => [
|
||||||
|
'de' => '<ul><li>fix multiple session cookie header lines </li>'
|
||||||
|
.'<li>causes "Connection reset by peer" errors </li>'
|
||||||
|
.'<li>error occur in some load balancer configurations because of to long headers</li></ul>',
|
||||||
|
'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' => [],
|
||||||
|
];
|
35
modules/core/Session_sidcookiefix.php
Normal file
35
modules/core/Session_sidcookiefix.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* https://www.d3data.de
|
||||||
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
|
* @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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Loading…
Reference in New Issue
Block a user