add some info logs

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

View File

@ -242,11 +242,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;
}
@ -259,16 +263,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);
}
@ -354,6 +358,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;
}
@ -362,6 +367,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
@ -373,6 +380,8 @@ class d3geoip extends BaseModel
|| strtolower(Registry::getConfig()->getActiveView()->getClassKey()) == 'mallstart'
)
) {
$this->_getModConfig()->d3getLog()->info(__CLASS__, __FUNCTION__, __LINE__, 'prepare shop change to '.$iNewShop);
$oNewConf = new Config();
$oNewConf->setShopId($iNewShop);
$oNewConf->init();
@ -410,6 +419,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();