2015-12-24 12:51:39 +01:00
|
|
|
|
<?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 <EFBFBD> D<EFBFBD> Data Development, Thomas Dartsch
|
|
|
|
|
* @author D<EFBFBD> Data Development - Daniel Seifert <ds@shopmodule.com>
|
|
|
|
|
* @link http://www.oxidmodule.com
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-17 09:29:09 +02:00
|
|
|
|
namespace D3\GeoIp\Setup;
|
|
|
|
|
|
|
|
|
|
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
|
|
|
|
|
use D3\ModCfg\Application\Model\Installwizzard\d3installdbfield;
|
|
|
|
|
use D3\ModCfg\Application\Model\Installwizzard\d3installdbrecord;
|
|
|
|
|
use d3\modcfg\Application\Model\d3database;
|
|
|
|
|
use D3\ModCfg\Application\Model\Installwizzard\d3installdbtable;
|
|
|
|
|
use OxidEsales\Eshop\Application\Model\Shop;
|
|
|
|
|
use OxidEsales\Eshop\Core\DatabaseProvider;
|
|
|
|
|
use OxidEsales\Eshop\Core\Registry;
|
|
|
|
|
use OxidEsales\Facts\Facts;
|
|
|
|
|
|
2015-12-24 12:51:39 +01:00
|
|
|
|
class d3geoip_update extends d3install_updatebase
|
|
|
|
|
{
|
|
|
|
|
public $sModKey = 'd3_geoip';
|
|
|
|
|
public $sModName = 'GeoIP';
|
2018-01-25 10:51:36 +01:00
|
|
|
|
public $sModVersion = '3.1.0.0';
|
|
|
|
|
public $sModRevision = '3100';
|
|
|
|
|
public $sBaseConf = '9qGv2==ZmhGbXhxSWUvZ25tSjFMV3J5aTExOTdhdWg2QkdrdHJBT09CajlXUzRDOGdMZ0YraEp1N0xPc
|
|
|
|
|
WkyOGhMZDBKMmwyUldaOXVrNDNjOWtMRW9BZEJ3VjY5NWQyMmZ3VG9qdHhRSVF4NXYvUGZqUmpxZm1Td
|
|
|
|
|
i9HbkxNZDRxVzNRRlZrRForU0RMSHVNR25hR1ROMkt0ZUM0SXpnKzBYUHJnc0Y1dDJYaDNIMEsrWE9uR
|
|
|
|
|
1FkbmJ4VUlMSGd1UEYxT0pPdGJhazQ4b1l6WDBBRElkM1dTWFM4VFg4S0didCs1aG1lNG9QYTh4YmVZe
|
|
|
|
|
XhDL3N0aXFncEhHWDJqNFFyQ0VDTFlkWUFVR20zU2RuZ05NUnREZythR2x1Z2VQOTYvbXNHZVVHMW9zN
|
|
|
|
|
UUrZ3pOeW9TUmo3MDg4dGx0RkRUK0wzb2k=';
|
2015-12-24 12:51:39 +01:00
|
|
|
|
public $sRequirements = '';
|
|
|
|
|
public $sBaseValue = '';
|
|
|
|
|
|
2018-01-25 12:13:05 +01:00
|
|
|
|
public $sMinModCfgVersion = '4.4.1.0';
|
|
|
|
|
|
2015-12-24 12:51:39 +01:00
|
|
|
|
protected $_aUpdateMethods = array(
|
|
|
|
|
array('check' => 'checkGeoIpTableExist',
|
|
|
|
|
'do' => 'updateGeoIpTableExist'),
|
|
|
|
|
array('check' => 'checkModCfgItemExist',
|
|
|
|
|
'do' => 'updateModCfgItemExist'),
|
2018-01-25 10:51:36 +01:00
|
|
|
|
array('check' => 'hasDeleteGeoIpTableFields',
|
|
|
|
|
'do' => 'deleteGeoIpTableFields'),
|
2015-12-24 12:51:39 +01:00
|
|
|
|
array('check' => 'checkGeoIpFields',
|
|
|
|
|
'do' => 'fixGeoIpFields'),
|
|
|
|
|
array('check' => 'checkIndizes',
|
|
|
|
|
'do' => 'fixIndizes'),
|
2018-01-25 10:51:36 +01:00
|
|
|
|
array('check' => 'checkGeoIpTableEngine',
|
|
|
|
|
'do' => 'updateGeoIpTableEngine'),
|
|
|
|
|
array('check' => 'checkGeoIpItems',
|
|
|
|
|
'do' => 'updateGeoIpItems'),
|
2015-12-24 12:51:39 +01:00
|
|
|
|
array('check' => 'hasUnregisteredFiles',
|
|
|
|
|
'do' => 'showUnregisteredFiles'),
|
|
|
|
|
array('check' => 'checkRegisteredComponent',
|
|
|
|
|
'do' => 'unregisterComponent'),
|
|
|
|
|
array('check' => 'checkModCfgSameRevision',
|
|
|
|
|
'do' => 'updateModCfgSameRevision'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Standardwerte f<>r checkMultiLangTables() und fixRegisterMultiLangTables()
|
|
|
|
|
public $aMultiLangTables = array();
|
|
|
|
|
|
|
|
|
|
public $aFields = array(
|
|
|
|
|
'D3GEOIPSHOP' => array(
|
|
|
|
|
'sTableName' => 'oxcountry',
|
|
|
|
|
'sFieldName' => 'D3GEOIPSHOP',
|
|
|
|
|
'sType' => 'VARCHAR(10)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => 'oxbaseshop',
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3GEOIPLANG' => array(
|
|
|
|
|
'sTableName' => 'oxcountry',
|
|
|
|
|
'sFieldName' => 'D3GEOIPLANG',
|
|
|
|
|
'sType' => 'TINYINT(2)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => '-1',
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3GEOIPCUR' => array(
|
|
|
|
|
'sTableName' => 'oxcountry',
|
|
|
|
|
'sFieldName' => 'D3GEOIPCUR',
|
|
|
|
|
'sType' => 'TINYINT(2)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => '-1',
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3GEOIPURL' => array(
|
|
|
|
|
'sTableName' => 'oxcountry',
|
|
|
|
|
'sFieldName' => 'D3GEOIPURL',
|
|
|
|
|
'sType' => 'VARCHAR(255)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'D3IP' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3IP',
|
|
|
|
|
'sType' => 'VARCHAR(45)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'D3STARTIP' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3STARTIP',
|
|
|
|
|
'sType' => 'VARCHAR(39)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3ENDIP' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3ENDIP',
|
|
|
|
|
'sType' => 'VARCHAR(39)',
|
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3STARTIPNUM' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'sFieldName' => 'D3STARTIPBIN',
|
|
|
|
|
'sType' => 'VARBINARY(16)',
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3ENDIPNUM' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'sFieldName' => 'D3ENDIPBIN',
|
|
|
|
|
'sType' => 'VARBINARY(16)',
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'blNull' => false,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3ISO' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3ISO',
|
|
|
|
|
'sType' => 'CHAR(2)',
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'blNull' => true,
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3COUNTRYNAME' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3COUNTRYNAME',
|
|
|
|
|
'sType' => 'VARCHAR(50)',
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'blNull' => true,
|
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3CONTINENTCODE' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3CONTINENTCODE',
|
|
|
|
|
'sType' => 'CHAR(2)',
|
|
|
|
|
'blNull' => true,
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'sDefault' => false,
|
|
|
|
|
'sComment' => '',
|
|
|
|
|
'sExtra' => '',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
public $aIndizes = array(
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'PRIMARY' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sType' => 'PRIMARY',
|
|
|
|
|
'sName' => 'PRIMARY',
|
|
|
|
|
'aFields' => array(
|
|
|
|
|
'D3IP' => 'D3IP',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'IPBIN' => array(
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sType' => 'INDEX',
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'sName' => 'IPBIN',
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'aFields' => array(
|
2018-01-25 10:51:36 +01:00
|
|
|
|
'D3STARTIPNUM' => 'D3STARTIPBIN',
|
|
|
|
|
'D3ENDIPNUM' => 'D3ENDIPBIN',
|
2015-12-24 12:51:39 +01:00
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'D3ISO' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sType' => 'INDEX',
|
|
|
|
|
'sName' => 'D3ISO',
|
|
|
|
|
'aFields' => array(
|
|
|
|
|
'D3ISO' => 'D3ISO',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2018-01-25 10:51:36 +01:00
|
|
|
|
public $aDeleteFields = array(
|
|
|
|
|
'D3STARTIPNUM' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3STARTIPNUM',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
'D3ENDIPNUM' => array(
|
|
|
|
|
'sTableName' => 'd3geoip',
|
|
|
|
|
'sFieldName' => 'D3ENDIPNUM',
|
|
|
|
|
'blMultilang' => false,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2015-12-24 12:51:39 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function checkGeoIpTableExist()
|
|
|
|
|
{
|
|
|
|
|
return $this->_checkTableNotExist('d3geoip');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function updateGeoIpTableExist()
|
|
|
|
|
{
|
|
|
|
|
$blRet = false;
|
|
|
|
|
if ($this->checkGeoIpTableExist()) {
|
2018-01-25 10:51:36 +01:00
|
|
|
|
$blRet = $this->_addTable2('d3geoip', $this->aFields, $this->aIndizes, 'GeoIP', 'InnoDB');
|
2015-12-24 12:51:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-25 10:51:36 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
* @throws oxSystemComponentException
|
|
|
|
|
*/
|
|
|
|
|
public function hasDeleteGeoIpTableFields()
|
|
|
|
|
{
|
|
|
|
|
/** @var d3installdbfield $oInstallDbField */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oInstallDbField = oxNew(d3installdbfield::class, $this);
|
2018-01-25 10:51:36 +01:00
|
|
|
|
return $oInstallDbField->checkDeleteFields();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
* @throws oxSystemComponentException
|
|
|
|
|
*/
|
|
|
|
|
public function deleteGeoIpTableFields()
|
|
|
|
|
{
|
|
|
|
|
$blRet = false;
|
|
|
|
|
if ($this->hasDeleteGeoIpTableFields()) {
|
|
|
|
|
/** @var d3installdbfield $oInstallDbField */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oInstallDbField = oxNew(d3installdbfield::class, $this);
|
2018-01-25 10:51:36 +01:00
|
|
|
|
$blRet = $oInstallDbField->fixDeleteFields(__METHOD__);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool true, if table has wrong engine
|
|
|
|
|
* @throws oxSystemComponentException
|
|
|
|
|
*/
|
|
|
|
|
public function checkGeoIpTableEngine()
|
|
|
|
|
{
|
|
|
|
|
/** @var d3installdbtable $oDbTable */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oDbTable = oxNew(d3installdbtable::class, $this);
|
2018-01-25 10:51:36 +01:00
|
|
|
|
$aData = $oDbTable->getTableData('d3geoip');
|
|
|
|
|
|
|
|
|
|
if (isset($aData) && count($aData) && isset($aData['ENGINE']) && $aData['ENGINE'] == 'InnoDB') {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-17 09:29:09 +02:00
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
|
|
|
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
|
|
|
|
|
*/
|
2018-01-25 10:51:36 +01:00
|
|
|
|
public function updateGeoIpTableEngine()
|
|
|
|
|
{
|
|
|
|
|
/** @var d3installdbtable $oDbTable */
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oDbTable = oxNew(d3installdbtable::class, $this);
|
2018-01-25 10:51:36 +01:00
|
|
|
|
$blRet = $oDbTable->changeTableEngine('d3geoip', 'InnoDB');
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-24 12:51:39 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function checkGeoIpItems()
|
|
|
|
|
{
|
|
|
|
|
$aWhere = array(
|
|
|
|
|
'D3ISO' => 'DE',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$blRet = $this->_checkTableItemNotExist('d3geoip', $aWhere);
|
|
|
|
|
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function updateGeoIpItems()
|
|
|
|
|
{
|
|
|
|
|
return $this->_confirmMessage('D3_GEOIP_UPDATE_ITEMINSTALL');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
2020-04-17 09:29:09 +02:00
|
|
|
|
* @throws \Doctrine\DBAL\DBALException
|
|
|
|
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
2015-12-24 12:51:39 +01:00
|
|
|
|
*/
|
|
|
|
|
public function checkModCfgItemExist()
|
|
|
|
|
{
|
|
|
|
|
$blRet = false;
|
|
|
|
|
foreach ($this->getShopList() as $oShop) {
|
|
|
|
|
/** @var $oShop oxshop */
|
|
|
|
|
$aWhere = array(
|
|
|
|
|
'oxmodid' => $this->sModKey,
|
|
|
|
|
'oxnewrevision' => $this->sModRevision,
|
|
|
|
|
'oxshopid' => $oShop->getId(),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$blRet = $this->_checkTableItemNotExist('d3_cfg_mod', $aWhere);
|
|
|
|
|
|
|
|
|
|
if ($blRet) {
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function updateModCfgItemExist()
|
|
|
|
|
{
|
|
|
|
|
$blRet = false;
|
|
|
|
|
|
|
|
|
|
if ($this->checkModCfgItemExist()) {
|
|
|
|
|
foreach ($this->getShopList() as $oShop) {
|
|
|
|
|
/** @var $oShop oxshop */
|
|
|
|
|
$aWhere = array(
|
|
|
|
|
'oxmodid' => $this->sModKey,
|
|
|
|
|
'oxshopid' => $oShop->getId(),
|
|
|
|
|
'oxnewrevision' => $this->sModRevision,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if ($this->_checkTableItemNotExist('d3_cfg_mod', $aWhere)) {
|
|
|
|
|
// update don't use this property
|
|
|
|
|
unset($aWhere['oxnewrevision']);
|
|
|
|
|
|
|
|
|
|
$aInsertFields = array(
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXID',
|
|
|
|
|
'content' => "md5('" . $this->sModKey . " " . $oShop->getId() . " de')",
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => false,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXSHOPID',
|
|
|
|
|
'content' => $oShop->getId(),
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXMODID',
|
|
|
|
|
'content' => $this->sModKey,
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXNAME',
|
|
|
|
|
'content' => $this->sModName,
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXACTIVE',
|
|
|
|
|
'content' => "0",
|
|
|
|
|
'force_update' => false,
|
|
|
|
|
'use_quote' => false,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXBASECONFIG',
|
|
|
|
|
'content' => $this->sBaseConf,
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXSERIAL',
|
|
|
|
|
'content' => "",
|
|
|
|
|
'force_update' => false,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXINSTALLDATE',
|
|
|
|
|
'content' => "NOW()",
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => false,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXVERSION',
|
|
|
|
|
'content' => $this->sModVersion,
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXSHOPVERSION',
|
2020-04-17 09:29:09 +02:00
|
|
|
|
'content' => Registry::getConfig()->getEdition(),
|
2015-12-24 12:51:39 +01:00
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array (
|
|
|
|
|
'fieldname' => 'OXREQUIREMENTS',
|
|
|
|
|
'content' => $this->sRequirements,
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
'fieldname' => 'OXVALUE',
|
|
|
|
|
'content' => $this->sBaseValue,
|
|
|
|
|
'force_update' => false,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
'fieldname' => 'OXNEWREVISION',
|
|
|
|
|
'content' => $this->sModRevision,
|
|
|
|
|
'force_update' => true,
|
|
|
|
|
'use_quote' => true,
|
|
|
|
|
'use_multilang' => false,
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$blRet = $this->_updateTableItem2('d3_cfg_mod', $aInsertFields, $aWhere);
|
|
|
|
|
|
|
|
|
|
if ($this->getStepByStepMode()) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* change default value for shop id in EE
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function checkGeoIpFields()
|
|
|
|
|
{
|
|
|
|
|
/** @var $oShop oxshop */
|
|
|
|
|
$oShop = $this->getShopList()->current();
|
|
|
|
|
$this->aFields['D3GEOIPSHOP']['sDefault'] = $oShop->getId();
|
|
|
|
|
|
|
|
|
|
return $this->checkFields();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* change default value for shop id in EE
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function fixGeoIpFields()
|
|
|
|
|
{
|
|
|
|
|
/** @var $oShop oxshop */
|
|
|
|
|
$oShop = $this->getShopList()->current();
|
|
|
|
|
$this->aFields['D3GEOIPSHOP']['sDefault'] = $oShop->getId();
|
|
|
|
|
|
|
|
|
|
return $this->fixFields();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function hasUnregisteredFiles()
|
|
|
|
|
{
|
|
|
|
|
return $this->_hasUnregisteredFiles('d3geoip', array('d3FileRegister'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public function showUnregisteredFiles()
|
|
|
|
|
{
|
|
|
|
|
return $this->_showUnregisteredFiles('d3geoip', array('d3FileRegister'));
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-25 10:51:36 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
* @throws oxConnectionException
|
|
|
|
|
*/
|
2015-12-24 12:51:39 +01:00
|
|
|
|
public function checkRegisteredComponent()
|
|
|
|
|
{
|
2020-04-17 09:29:09 +02:00
|
|
|
|
/** @var $oShop Shop */
|
2015-12-24 12:51:39 +01:00
|
|
|
|
foreach ($this->getShopListByActiveModule('d3geoip') as $oShop) {
|
|
|
|
|
$aUserComponents = $this->_d3GetUserComponentsFromDb($oShop);
|
|
|
|
|
|
|
|
|
|
if (is_array($aUserComponents)
|
|
|
|
|
&& in_array('d3cmp_geoip', array_keys($aUserComponents))
|
|
|
|
|
) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-25 10:51:36 +01:00
|
|
|
|
/**
|
|
|
|
|
* @return bool
|
|
|
|
|
* @throws oxConnectionException
|
|
|
|
|
*/
|
2015-12-24 12:51:39 +01:00
|
|
|
|
public function unregisterComponent()
|
|
|
|
|
{
|
|
|
|
|
$blRet = true;
|
|
|
|
|
$sVarName = 'aUserComponentNames';
|
|
|
|
|
|
|
|
|
|
/** @var $oShop oxshop */
|
|
|
|
|
foreach ($this->getShopList() as $oShop) {
|
|
|
|
|
$aUserComponents = $this->_d3GetUserComponentsFromDb($oShop);
|
|
|
|
|
|
|
|
|
|
if (is_array($aUserComponents)
|
|
|
|
|
&& in_array('d3cmp_geoip', array_keys($aUserComponents))
|
|
|
|
|
) {
|
|
|
|
|
unset($aUserComponents['d3cmp_geoip']);
|
|
|
|
|
if (false == count($aUserComponents)) {
|
|
|
|
|
$aUserComponents = null;
|
|
|
|
|
}
|
|
|
|
|
$this->fixOxconfigVariable($sVarName, $oShop->getId(), '', $aUserComponents, 'arr');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $blRet;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-17 09:29:09 +02:00
|
|
|
|
/**
|
|
|
|
|
* @param Shop $oShop
|
|
|
|
|
*
|
|
|
|
|
* @return array|null
|
|
|
|
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseConnectionException
|
|
|
|
|
* @throws \OxidEsales\Eshop\Core\Exception\DatabaseErrorException
|
|
|
|
|
*/
|
|
|
|
|
protected function _d3GetUserComponentsFromDb(Shop $oShop)
|
2015-12-24 12:51:39 +01:00
|
|
|
|
{
|
|
|
|
|
$sVarName = 'aUserComponentNames';
|
|
|
|
|
$sModuleId = '';
|
2020-04-17 09:29:09 +02:00
|
|
|
|
$oDb = DatabaseProvider::getDb(DatabaseProvider::FETCH_MODE_ASSOC);
|
|
|
|
|
$sSelect = "SELECT oxvartype as type, ".Registry::getConfig()->getDecodeValueQuery().
|
2015-12-24 12:51:39 +01:00
|
|
|
|
" as value FROM `oxconfig` WHERE oxshopid = ".$oDb->quote($oShop->getId()).
|
|
|
|
|
" AND oxvarname = ".$oDb->quote($sVarName).
|
|
|
|
|
" AND oxmodule = ".$oDb->quote($sModuleId);
|
|
|
|
|
|
|
|
|
|
$aResult = $oDb->getAll($sSelect);
|
|
|
|
|
$aUserComponents = is_array($aResult) && count($aResult)
|
2020-04-17 09:29:09 +02:00
|
|
|
|
? Registry::getConfig()->decodeValue($aResult[0]['type'], $aResult[0]['value'])
|
2015-12-24 12:51:39 +01:00
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
return $aUserComponents;
|
|
|
|
|
}
|
|
|
|
|
}
|