add some info logs

This commit is contained in:
Daniel Seifert 2022-10-13 08:41:09 +02:00
parent 2117dfbf68
commit 9a2f436bd3
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
2 changed files with 19 additions and 6 deletions

View File

@ -252,11 +252,15 @@ class d3geoip extends BaseModel
{
startProfile(__METHOD__);
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'start shop or url switch');
$this->performURLSwitch();
$this->performShopSwitch();
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'end shop or url switch');
if (!$this->_getModConfig()->isActive()
|| false == $this->_getModConfig()->getValue('blChangeLang')) {
|| false == $this->_getModConfig()->getValue('blChangeLang')
) {
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'language change option or module is disabled');
stopProfile(__METHOD__);
return;
}
@ -269,16 +273,16 @@ class d3geoip extends BaseModel
&& Registry::getSession()->getVariable('d3isSetLang') === null
&& $oCountry->getId() && $oCountry->getFieldData('d3geoiplang') > -1
) {
$this->_getLog()->log(
d3log::INFO,
$language = (int) $oCountry->getFieldData('d3geoiplang');
$this->_getModConfig()->info(
__CLASS__,
__FUNCTION__,
__LINE__,
'set language',
$this->getIP().' => '.$oCountry->getFieldData('d3geoiplang')
$this->getIP().' => '.$language
);
Registry::getLang()->setTplLanguage((int) $oCountry->getFieldData('d3geoiplang'));
Registry::getLang()->setBaseLanguage((int) $oCountry->getFieldData('d3geoiplang'));
Registry::getLang()->setTplLanguage($language);
Registry::getLang()->setBaseLanguage($language);
Registry::getSession()->setVariable('d3isSetLang', true);
}
@ -364,6 +368,7 @@ class d3geoip extends BaseModel
public function performShopSwitch()
{
if (!$this->_getModConfig()->isActive() || !$this->_getModConfig()->getValue('blChangeShop')) {
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'shop change option or module is disabled');
return;
}
@ -372,6 +377,8 @@ class d3geoip extends BaseModel
$oCountry = $this->getUserLocationCountryObject();
$iNewShop = $oCountry->getFieldData('d3geoipshop');
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'check allowed shop change');
if (Registry::getRequest()->getRequestEscapedParameter('d3redirect') != 1
&& false == $this->isAdmin()
&& Registry::getUtils()->isSearchEngine() === false
@ -383,6 +390,8 @@ class d3geoip extends BaseModel
|| strtolower($this->getConfig()->getActiveView()->getClassKey()) == 'mallstart'
)
) {
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'prepare shop change to '.$iNewShop);
$oNewConf = new Config();
$oNewConf->setShopId($iNewShop);
$oNewConf->init();
@ -420,6 +429,8 @@ class d3geoip extends BaseModel
$this->getIP().' => '.$sUrl
);
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'change to shop url', $sUrl);
header("Location: ".$sUrl);
exit();
}

View File

@ -43,7 +43,9 @@ class d3_oxcmp_lang_geoip extends d3_oxcmp_lang_geoip_parent
if (d3_cfg_mod::get($this->_sModId)->isActive()) {
/** @var $oLocation d3geoip */
$oLocation = oxNew(d3geoip::class);
d3_cfg_mod::get($this->_sModId)->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'start perform language switch');
$oLocation->setCountryLanguage();
d3_cfg_mod::get($this->_sModId)->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'end perform language switch');
}
parent::init();