Vergelijk commits
No commits in common. "main" and "rel_7.x_SourceGuardian_from_PHP8.0" have entirely different histories.
main
...
rel_7.x_So
2
.php-cs-fixer.php
Normal file
2
.php-cs-fixer.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
728
Application/Controller/Admin/Configuration/d3mod_status.php
Normal file
728
Application/Controller/Admin/Configuration/d3mod_status.php
Normal file
@ -0,0 +1,728 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\d3utils;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\d3str;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use D3\ModCfg\Application\Model\Shopcompatibility\d3ShopCompatibilityAdapterHandler;
|
||||
use D3\ModCfg\Application\Model\Shopcompatibility\d3shopversionconverter;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use Doctrine\DBAL\Driver\Exception as DBALDriverException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\LanguageNotFoundException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\ShopVersion;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseException;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3mod_status extends d3_cfg_mod_main
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/configuration/status';
|
||||
/**
|
||||
* additional multilang item, which will added as last part to help url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sHelpLinkMLAdd = 'D3MODCFG_LIB_HELPLINK_STATUS';
|
||||
public $aModuleSets = [];
|
||||
/** @var d3install */
|
||||
public $oInstall;
|
||||
public $aRemoteLibs = [];
|
||||
public $selectedModId;
|
||||
protected $_blRefreshModList = false;
|
||||
protected $_aHiddenModules = [];
|
||||
public $sErrorMessage = false;
|
||||
|
||||
/**
|
||||
* d3mod_status constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->addTplParam('blGetRemoteUpdateStatus', false);
|
||||
$this->addTplParam('sErrorMLMsg', false);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws DBALDriverException
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$this->aModuleSets = d3_cfg_mod::loadAll($this->getModuleType());
|
||||
|
||||
$this->oInstall = d3install::getInstance();
|
||||
$this->oInstall->init();
|
||||
|
||||
$sRet = parent::render();
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleType()
|
||||
{
|
||||
return 'lib';
|
||||
}
|
||||
|
||||
public function getRemoteModList()
|
||||
{
|
||||
$this->_blRefreshModList = true;
|
||||
$this->addTplParam('blGetRemoteUpdateStatus', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
* @param bool $blForceRefresh
|
||||
* @return array|bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DatabaseException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getRemoteModuleData($sModId, $blForceRefresh = false)
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$oUpdateServer = d3install::getInstance()->getFromUpdateServer();
|
||||
$this->sErrorMessage = false;
|
||||
|
||||
try {
|
||||
if (d3_cfg_mod::isAvailable(($sModId)) && d3_cfg_mod::get($sModId)->getLicenseData('modversion')) {
|
||||
$oUpdateServer->setParameter('sLicModVersion', d3_cfg_mod::get($sModId)->getLicenseData('modversion'));
|
||||
}
|
||||
$oUpdateServer->setParameter('sModId', $sModId);
|
||||
} catch (d3_cfg_mod_exception $oEx) {
|
||||
$this->sErrorMessage = $oEx->getMessage();
|
||||
}
|
||||
|
||||
/** @var d3ShopCompatibilityAdapterHandler $oD3CompatibilityAdapterHandler */
|
||||
$oD3CompatibilityAdapterHandler = oxNew(d3ShopCompatibilityAdapterHandler::class);
|
||||
/** @var d3shopversionconverter $oShopVersionConverter */
|
||||
$oShopVersionConverter = oxNew(d3shopversionconverter::class);
|
||||
$sShopEdition = $oShopVersionConverter->fixEditionToDefaultEdition(
|
||||
$this->getShopEdition()
|
||||
);
|
||||
$sShopVersion = $oD3CompatibilityAdapterHandler->getWOBetaShopVersion(
|
||||
$oShopVersionConverter->fixVersionToDefaultEdition(ShopVersion::getVersion())
|
||||
);
|
||||
|
||||
$oUpdateServer->setParameter('sEdition', $sShopEdition);
|
||||
$oUpdateServer->setParameter('sShopVersion', $sShopVersion);
|
||||
if ($blForceRefresh || $this->_blRefreshModList) {
|
||||
$oUpdateServer->forceUpdate();
|
||||
$aModData = $oUpdateServer->getRemoteModuleVersion();
|
||||
} else {
|
||||
$aModData = [];
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $aModData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws DatabaseException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getAllRemoteModuleData()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$oUpdateServer = d3install::getInstance()->getFromUpdateServer();
|
||||
$oUpdateServer->setParameter('sModType', $this->getModuleType());
|
||||
|
||||
if ($this->_blRefreshModList) {
|
||||
$oUpdateServer->forceUpdate();
|
||||
}
|
||||
|
||||
$aModData = $oUpdateServer->getAllRemoteModules();
|
||||
|
||||
$aModData = $this->_unsetHiddenModules($aModData);
|
||||
|
||||
if (false == count($aModData)) {
|
||||
$aModData = [];
|
||||
} else {
|
||||
foreach ($aModData as $sIdent => $aModInfo) {
|
||||
$aModData[$sIdent]['modtitle'] = iconv("UTF-8", "ISO-8859-15", $aModInfo['modtitle']);
|
||||
}
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $aModData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aModuleList
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _unsetHiddenModules($aModuleList)
|
||||
{
|
||||
foreach ($aModuleList as $sKey => $aModuleData) {
|
||||
if (in_array($aModuleData['modid'], $this->_aHiddenModules)) {
|
||||
unset($aModuleList[$sKey]);
|
||||
}
|
||||
}
|
||||
return $aModuleList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function isInstalled($sModId)
|
||||
{
|
||||
/** @var d3_cfg_mod $oSet */
|
||||
$oSet = oxNew(d3_cfg_mod::class);
|
||||
foreach ($oSet->getModuleList() as $aModCfg) {
|
||||
if (strtolower($aModCfg['id']) == strtolower($sModId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aLib
|
||||
* @param $sVarName
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRemoteModVar($aLib, $sVarName)
|
||||
{
|
||||
if (isset($aLib[$sVarName . '_' . $this->getLangId()]) && $aLib[$sVarName . '_' . $this->getLangId()]) {
|
||||
return $aLib[$sVarName . '_' . $this->getLangId()];
|
||||
} elseif (isset($aLib[$sVarName . '_de']) && $aLib[$sVarName . '_de']) {
|
||||
return $aLib[$sVarName . '_de'];
|
||||
}
|
||||
|
||||
return $aLib[$sVarName];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws LanguageNotFoundException
|
||||
*/
|
||||
public function getLangId()
|
||||
{
|
||||
$sLangId = strtolower(Registry::getLang()->getLanguageAbbr());
|
||||
|
||||
if ($sLangId != 'de' && $sLangId != 'en') {
|
||||
$sLangId = 'en';
|
||||
}
|
||||
|
||||
return $sLangId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sVersion1
|
||||
* @param $sVersion2
|
||||
* @param $sCompareOperator
|
||||
* @return mixed
|
||||
*/
|
||||
public function version_compare($sVersion1, $sVersion2, $sCompareOperator)
|
||||
{
|
||||
// convert 4 digit version to 3 digit version, because version_compare get different informations
|
||||
$sVersion1 = preg_replace('@.0$@', '', $sVersion1);
|
||||
$sVersion2 = preg_replace('@.0$@', '', $sVersion2);
|
||||
return version_compare($sVersion1, $sVersion2, $sCompareOperator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sShopVersion
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function check4ShopUpdate($sShopVersion)
|
||||
{
|
||||
/** @var d3shopversionconverter $oShopVersionConverter */
|
||||
$oShopVersionConverter = oxNew(d3shopversionconverter::class);
|
||||
return version_compare(
|
||||
$oShopVersionConverter->fixVersionToDefaultEdition(ShopVersion::getVersion()),
|
||||
$sShopVersion,
|
||||
"<"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
* @param $sModVersion
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function check4LicenseUpdate($sModId, $sModVersion)
|
||||
{
|
||||
/** @var d3str $oStr */
|
||||
$oStr = oxNew(d3str::class);
|
||||
if (d3_cfg_mod::get($sModId)->getLicenseData('modversion')) {
|
||||
if ($oStr->versionToInt($sModVersion, 999) >
|
||||
$oStr->versionToInt(d3_cfg_mod::get($sModId)->getLicenseData('modversion'), 999)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getInstalledModuleList()
|
||||
{
|
||||
return $this->aModuleSets;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function saveModCfg()
|
||||
{
|
||||
$aParams = Registry::get(Request::class)->getRequestEscapedParameter('editval');
|
||||
$oSet = d3_cfg_mod::get(Registry::get(Request::class)->getRequestEscapedParameter('oxmodid'));
|
||||
$oSet->setLogData();
|
||||
$oSet->assign($aParams);
|
||||
$oSet->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getRemoteMods()
|
||||
{
|
||||
if (Registry::getSession()->hasVariable('d3RemoteLibs')) {
|
||||
$this->aRemoteLibs = Registry::getSession()->getVariable('d3RemoteLibs');
|
||||
}
|
||||
|
||||
return $this->aRemoteLibs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getInstallClass()
|
||||
{
|
||||
if (class_exists(d3install::class)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* schreibt Lizenzkey in Modulconfig
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function submit_licensekey()
|
||||
{
|
||||
if (! Registry::get(d3utils::class)->hasDemoshopMode()) {
|
||||
/** @var d3_cfg_mod $oSet */
|
||||
$oSet = d3_cfg_mod::get(Registry::get(Request::class)->getRequestEscapedParameter('oxmodid'));
|
||||
$oSet->setSerial(Registry::get(Request::class)->getRequestEscapedParameter('licensekey'));
|
||||
$oSet->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasConnectionError()
|
||||
{
|
||||
return $this->oInstall->blConnectError;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSelectedModId()
|
||||
{
|
||||
return $this->selectedModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModName
|
||||
* @return bool|string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getModuleCfgTplPath($sModName)
|
||||
{
|
||||
$tplIdent = '@'.Constants::OXID_MODULE_ID.'/admin/'.$sModName.'_cfg';
|
||||
|
||||
$renderer = ContainerFactory::getInstance()->getContainer()
|
||||
->get(TemplateRendererBridgeInterface::class)
|
||||
->getTemplateRenderer();
|
||||
|
||||
if ($renderer->exists($tplIdent)) {
|
||||
$this->selectedModId = $sModName;
|
||||
return $tplIdent;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if (false == Registry::get(d3utils::class)->hasDemoshopMode()) {
|
||||
$oModCfg = d3_cfg_mod::get(Registry::get(Request::class)->getRequestEscapedParameter('modid'));
|
||||
$oModCfg->prepareSaveData();
|
||||
$oModCfg->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function checkD3Log()
|
||||
{
|
||||
if (class_exists(d3log::class)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isExecAvailable()
|
||||
{
|
||||
if (function_exists('exec') && exec('echo EXEC') == 'EXEC') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sStatus
|
||||
* @param d3_cfg_mod|bool $oSet
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogStatus($sStatus, $oSet = false)
|
||||
{
|
||||
return $oSet->getLogStatus($sStatus, $oSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sLogType
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogTypeTranslation($sLogType)
|
||||
{
|
||||
return $this->d3getLog()->getLogTypeTranslation($sLogType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLicenceFrameUrl($sModId)
|
||||
{
|
||||
$aParams = [
|
||||
'cl' => 'd3mod_activation', // don't use d3mod_activation::class
|
||||
'modid' => $sModId,
|
||||
];
|
||||
return Registry::get(d3utils::class)->getAdminClassUrl($aParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $oSet
|
||||
* @return bool|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getExpireSpanString($oSet)
|
||||
{
|
||||
if ($oSet->isExpired()) {
|
||||
return Registry::getLang()->translateString('D3_CFG_MOD_STATUS_EXPIRED');
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
Registry::getLang()->translateString("D3_CFG_MOD_STATUS_EXPIRES_IN"),
|
||||
$oSet->getExpireTimeSpan()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function showNoUpdateMessage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleIdent()
|
||||
{
|
||||
return 'D3_MOD_LIB_INSTALLED';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $oModule
|
||||
* @param $aRemoteModData
|
||||
* @return bool
|
||||
*/
|
||||
public function moduleIsNewestVersion($oModule, $aRemoteModData)
|
||||
{
|
||||
return $this->checkModuleVersion($oModule, $aRemoteModData, '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $oModule
|
||||
* @param $aRemoteModData
|
||||
* @return bool
|
||||
*/
|
||||
public function hasNewerModuleVersion($oModule, $aRemoteModData)
|
||||
{
|
||||
return $this->checkModuleVersion($oModule, $aRemoteModData, '<');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $oModule
|
||||
* @param $aRemoteModData
|
||||
* @param $sCompare
|
||||
* @return bool
|
||||
*/
|
||||
public function checkModuleVersion($oModule, $aRemoteModData, $sCompare)
|
||||
{
|
||||
return (
|
||||
isset($aRemoteModData['newestversion'])
|
||||
&& $aRemoteModData['newestversion']['version']
|
||||
&& $this->version_compare($oModule->getFieldData('oxversion'), $aRemoteModData['newestversion']['version'], $sCompare)
|
||||
) || (
|
||||
(
|
||||
false == isset($aRemoteModData['availableversion']) ||
|
||||
!$aRemoteModData['newestversion']['version']
|
||||
)
|
||||
&& isset($aRemoteModData['availableversion'])
|
||||
&& $aRemoteModData['availableversion']['version']
|
||||
&& $this->version_compare($oModule->getFieldData('oxversion'), $aRemoteModData['availableversion']['version'], $sCompare)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $module
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getModTitle(d3_cfg_mod $module)
|
||||
{
|
||||
try {
|
||||
$sModTitle = $module->getModTitle();
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
$sModTitle = $module->getModBaseTitle();
|
||||
}
|
||||
|
||||
// can not use utf8_decode, because it contains encoded and unencoded chars
|
||||
$aSpecialChars = [ 'ü' => 'ü', 'ä' => 'ä', 'ö' => 'ö', 'Ö' => 'Ö', 'ß' => 'ß', 'à ' => 'à', 'á' => 'á', 'â' => 'â', 'ã' => 'ã', 'ù' => 'ù', 'ú' => 'ú', 'û' => 'û', 'Ù' => 'Ù', 'Ú' => 'Ú', 'Û' => 'Û', 'Ãœ' => 'Ü', 'ò' => 'ò', 'ó' => 'ó', 'ô' => 'ô', 'è' => 'è', 'é' => 'é', 'ê' => 'ê', 'ë' => 'ë', 'À' => 'À', 'Ã' => 'Á', 'Â' => 'Â', 'Ã' => 'Ã', 'Ä' => 'Ä', 'Ã…' => 'Å', 'Ç' => 'Ç', 'È' => 'È', 'É' => 'É', 'Ê' => 'Ê', 'Ë' => 'Ë', 'ÃŒ' => 'Ì', 'Ã' => 'Í', 'ÃŽ' => 'Î', 'Ã' => 'Ï', 'Ñ' => 'Ñ', 'Ã’' => 'Ò', 'Ó' => 'Ó', 'Ô' => 'Ô', 'Õ' => 'Õ', 'Ø' => 'Ø', 'Ã¥' => 'å', 'æ' => 'æ', 'ç' => 'ç', 'ì' => 'ì', 'Ã' => 'í', 'î' => 'î', 'ï' => 'ï', 'ð' => 'ð', 'ñ' => 'ñ', 'õ' => 'õ', 'ø' => 'ø', 'ý' => 'ý', 'ÿ' => 'ÿ', '€' => '€' ];
|
||||
|
||||
return str_replace(array_keys($aSpecialChars), $aSpecialChars, $sModTitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $module
|
||||
* @param $value
|
||||
* @return array|bool|null|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getLicenseData(d3_cfg_mod $module, $value)
|
||||
{
|
||||
try {
|
||||
$data = $module->getLicenseData($value);
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
$data = false;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $module
|
||||
* @param $value
|
||||
* @return array|bool|null|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getFormatedShopEditionList(d3_cfg_mod $module)
|
||||
{
|
||||
try {
|
||||
$data = $module->getFormatedShopEditionList();
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
$data = null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $module
|
||||
* @param $value
|
||||
* @return array|bool|null|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getFormatedShopIdList(d3_cfg_mod $module)
|
||||
{
|
||||
try {
|
||||
$data = $module->getFormatedShopIdList();
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
$data = null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $module
|
||||
* @param $value
|
||||
* @return array|bool|null|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getConfigInfoData(d3_cfg_mod $module)
|
||||
{
|
||||
try {
|
||||
$data = $module->getConfigInfoData();
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
$data = null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string
|
||||
*/
|
||||
public function getErrorMessage()
|
||||
{
|
||||
return $this->sErrorMessage;
|
||||
}
|
||||
}
|
56
Application/Controller/Admin/Configuration/d3modext.php
Normal file
56
Application/Controller/Admin/Configuration/d3modext.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
|
||||
class d3modext extends d3_cfg_mod_
|
||||
{
|
||||
protected $_hasListItems = false;
|
||||
|
||||
/**
|
||||
* d3modext constructor.
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws DBALException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
d3install::getInstance()->startUpdateFrame();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('sListClass', d3modext_list::class);
|
||||
$this->addTplParam('sMainClass', d3modext_status::class);
|
||||
return parent::render();
|
||||
}
|
||||
}
|
33
Application/Controller/Admin/Configuration/d3modext_list.php
Normal file
33
Application/Controller/Admin/Configuration/d3modext_list.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
|
||||
|
||||
class d3modext_list extends d3_cfg_mod_list
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('blShowLangSwitch', false);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
}
|
76
Application/Controller/Admin/Configuration/d3modext_new.php
Normal file
76
Application/Controller/Admin/Configuration/d3modext_new.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3modext_new extends d3mod_status
|
||||
{
|
||||
/**
|
||||
* additional multilang item, which will added as last part to help url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sHelpLinkMLAdd = 'D3MODCFG_EXT_HELPLINK_STATUS';
|
||||
protected $_sRemoteUpdateSessionVarname = 'd3RemoteExtList';
|
||||
protected $_sRemoteModuleSessionVarname = 'd3RemoteExt';
|
||||
protected $_sMenuSubItemTitle = 'd3mxextensions';
|
||||
public $aRemoteMods = [];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleType()
|
||||
{
|
||||
return 'ext';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getRemoteMods()
|
||||
{
|
||||
if (Registry::getSession()->hasVariable('d3RemoteExtensions')) {
|
||||
$this->aRemoteMods = Registry::getSession()->getVariable('d3RemoteExtensions');
|
||||
}
|
||||
|
||||
return $this->aRemoteMods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getShowNewItems()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getInstalledModuleList()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleIdent()
|
||||
{
|
||||
return 'D3_MOD_EXT_AVAILABLE';
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
class d3modext_status extends d3mod_status
|
||||
{
|
||||
/**
|
||||
* additional multilang item, which will added as last part to help url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sHelpLinkMLAdd = 'D3MODCFG_EXT_HELPLINK_STATUS';
|
||||
protected $_sRemoteUpdateSessionVarname = 'd3RemoteExtList';
|
||||
protected $_sRemoteModuleSessionVarname = 'd3RemoteExt';
|
||||
protected $_sMenuSubItemTitle = 'd3mxextensions';
|
||||
public $aRemoteMods = [];
|
||||
protected $_sClassName = self::class;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleType()
|
||||
{
|
||||
return 'ext';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getRemoteMods()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getShowNewItems()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleIdent()
|
||||
{
|
||||
return 'D3_MOD_EXT_INSTALLED';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsOrderStep()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
59
Application/Controller/Admin/Configuration/d3modlib.php
Normal file
59
Application/Controller/Admin/Configuration/d3modlib.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
|
||||
/**
|
||||
* Class d3modlib
|
||||
*/
|
||||
class d3modlib extends d3_cfg_mod_
|
||||
{
|
||||
protected $_hasListItems = false;
|
||||
|
||||
/**
|
||||
* d3modlib constructor.
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws DBALException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
d3install::getInstance()->startUpdateFrame();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('sListClass', d3modlib_list::class);
|
||||
$this->addTplParam('sMainClass', d3modlib_status::class);
|
||||
return parent::render();
|
||||
}
|
||||
}
|
33
Application/Controller/Admin/Configuration/d3modlib_list.php
Normal file
33
Application/Controller/Admin/Configuration/d3modlib_list.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
|
||||
|
||||
class d3modlib_list extends d3_cfg_mod_list
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('blShowLangSwitch', false);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod_licencecheck;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
|
||||
class d3modlib_status extends d3mod_status
|
||||
{
|
||||
/**
|
||||
* additional multilang item, which will added as last part to help url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sHelpLinkMLAdd = 'D3MODCFG_LIB_HELPLINK_STATUS';
|
||||
protected $_sRemoteUpdateSessionVarname = 'd3RemoteLibList';
|
||||
protected $_sRemoteModuleSessionVarname = 'd3RemoteLibs';
|
||||
public $aRemoteLibs = [];
|
||||
protected $_aHiddenModules = ['d3install_lib', 'd3log_lib', 'd3clrtmp_lib'];
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleType()
|
||||
{
|
||||
return 'lib';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getShowNewItems()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function showNoUpdateMessage()
|
||||
{
|
||||
$oLicenceCheck = new d3_cfg_mod_licencecheck(new d3_cfg_mod());
|
||||
return $oLicenceCheck->isSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getUsedMailMessageSlots()
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
$aSlots = $oLog->getUsedMailMessageSlots();
|
||||
array_push($aSlots, end($aSlots) + 1);
|
||||
|
||||
return $aSlots;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleIdent()
|
||||
{
|
||||
return 'D3_MOD_LIB_INSTALLED';
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Configuration;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_licence;
|
||||
|
||||
class d3modlib_support extends d3_cfg_mod_licence
|
||||
{
|
||||
protected $_sModId = 'd3modcfg_lib';
|
||||
protected $_hasNewsletterForm = false;
|
||||
protected $_modUseCurl = true;
|
||||
}
|
545
Application/Controller/Admin/Install/d3_mod_update.php
Normal file
545
Application/Controller/Admin/Install/d3_mod_update.php
Normal file
@ -0,0 +1,545 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* https://www.d3data.de
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
*/
|
||||
|
||||
namespace D3\ModCfg\Application\Controller\Admin\Install;
|
||||
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\d3utils;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
|
||||
class d3_mod_update extends AdminController
|
||||
{
|
||||
public $sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/install/update';
|
||||
protected $_sMenuSubItemTitle = 'D3_INSTALL';
|
||||
protected $_sStep = false;
|
||||
public $sRedirectStep = false;
|
||||
protected $_sAction = false;
|
||||
public $sFnc = false;
|
||||
public $aCheckList = [];
|
||||
protected $_blUpdateBreak = false;
|
||||
protected $_aMessages;
|
||||
protected $_blError;
|
||||
protected $_sErrorMsg;
|
||||
protected $_aUserSelections = [];
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->addTplParam('formercl', Registry::get(Request::class)->getRequestEscapedParameter('formercl'));
|
||||
$this->addTplParam('default_edit', false);
|
||||
$this->addTplParam('bottom_buttons', false);
|
||||
$this->addTplParam('actlocation', false);
|
||||
$this->addTplParam('issubvariant', false);
|
||||
$this->addTplParam('box', false);
|
||||
$this->addTplParam('Errors', false);
|
||||
$this->addTplParam('blHideLinkBar', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('sCheckMethod', Registry::getConfig()->getActiveView()->getViewDataElement('sCheckMethod'));
|
||||
$this->addTplParam('sUpdateMethod', Registry::getConfig()->getActiveView()->getViewDataElement('sUpdateMethod'));
|
||||
$this->addTplParam('sUpdateClass', Registry::getConfig()->getActiveView()->getViewDataElement('sUpdateClass'));
|
||||
|
||||
if ($this->sFnc && method_exists($this, $this->sFnc)) {
|
||||
$sRet = $this->{$this->sFnc}();
|
||||
} elseif ($this->sFnc) {
|
||||
$this->addTplParam('blNonExistingFunction', $this->sFnc);
|
||||
return $this->sThisTemplate;
|
||||
}
|
||||
|
||||
if ($sRet) {
|
||||
return $sRet;
|
||||
} else {
|
||||
return $this->sThisTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function requireUpdate()
|
||||
{
|
||||
return d3install::getInstance()->checkForRequiredUpdates();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDemoShopMode()
|
||||
{
|
||||
return Registry::get(d3utils::class)->hasDemoshopMode();
|
||||
}
|
||||
|
||||
public function skipupdate()
|
||||
{
|
||||
$this->setAction('skip');
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew(d3install_updatebase::class);
|
||||
$oUpdateBase->setUpdateSkipFlag();
|
||||
}
|
||||
|
||||
public function sessionskip()
|
||||
{
|
||||
$sCheckMethod = Registry::get(Request::class)->getRequestEscapedParameter('sCheckMethod');
|
||||
$sUpdateMethod = Registry::get(Request::class)->getRequestEscapedParameter('sUpdateMethod');
|
||||
$sUpdateClass = Registry::get(Request::class)->getRequestEscapedParameter('sUpdateClass');
|
||||
Registry::get(Request::class)->getRequestEscapedParameter('exectype');
|
||||
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew($sUpdateClass);
|
||||
$sCheckHash = $oUpdateBase->getHash($sUpdateClass, $sCheckMethod);
|
||||
$sUpdateHash = $oUpdateBase->getHash($sUpdateClass, $sUpdateMethod);
|
||||
|
||||
$aSkipHashs = $oUpdateBase->getSessionSkipHashs();
|
||||
$aSkipHashs['check'][$sCheckHash] = $sCheckHash;
|
||||
$aSkipHashs['update'][$sUpdateHash] = $sUpdateHash;
|
||||
Registry::getSession()->setVariable('aD3UpdateSkipHashs', $aSkipHashs);
|
||||
}
|
||||
|
||||
public function everskip()
|
||||
{
|
||||
if (! $this->hasDemoShopMode()) {
|
||||
$sCheckMethod = Registry::get(Request::class)->getRequestEscapedParameter('sCheckMethod');
|
||||
$sUpdateMethod = Registry::get(Request::class)->getRequestEscapedParameter('sUpdateMethod');
|
||||
$sUpdateClass = Registry::get(Request::class)->getRequestEscapedParameter('sUpdateClass');
|
||||
Registry::get(Request::class)->getRequestEscapedParameter('exectype');
|
||||
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew($sUpdateClass);
|
||||
$sCheckHash = $oUpdateBase->getHash($sUpdateClass . '-' . $sCheckMethod);
|
||||
$sUpdateHash = $oUpdateBase->getHash($sUpdateClass . '-' . $sUpdateMethod);
|
||||
|
||||
$aSkipHashs = $oUpdateBase->getConfigSkipHashs();
|
||||
|
||||
$aSkipHashs['check'][$sCheckHash] = $sCheckHash;
|
||||
$aSkipHashs['update'][$sUpdateHash] = $sUpdateHash;
|
||||
|
||||
$oUpdateBase->setConfigSkipHashs($aSkipHashs);
|
||||
} else {
|
||||
$this->sessionskip();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws DBALException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function checklist()
|
||||
{
|
||||
$this->setAction('checklist');
|
||||
$blStepByStep = false;
|
||||
$blUseBreak = false;
|
||||
$this->aCheckList = d3install::getInstance()->performUpdateChecklist($blStepByStep, $blUseBreak);
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('checkasfile')) {
|
||||
/** @var d3filesystem $oFS */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
$oFS->startDirectDownload('install.txt', $this->_getCheckList4File());
|
||||
}
|
||||
|
||||
if (is_string($this->aCheckList[count($this->aCheckList) - 1]['type']) &&
|
||||
strtolower($this->aCheckList[count($this->aCheckList) - 1]['type']) == 'break'
|
||||
) {
|
||||
$this->_blUpdateBreak = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function _getCheckList4File()
|
||||
{
|
||||
$sText = '';
|
||||
foreach ($this->getCheckList() as $aCheckItem) {
|
||||
$sText .= $this->getCheckItemDesc($aCheckItem['type']) . "\r\n";
|
||||
if ($aCheckItem['log']) {
|
||||
$sText .= $aCheckItem['log'] . "\r\n";
|
||||
}
|
||||
$sText .= "\r\n";
|
||||
}
|
||||
|
||||
return $sText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws d3ParameterNotFoundException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function autoinstall()
|
||||
{
|
||||
if (! $this->hasDemoShopMode()) {
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew(d3install_updatebase::class);
|
||||
$oUpdateBase->resetUpdateSkipFlag();
|
||||
// reset
|
||||
$this->setAction('autoinstall');
|
||||
$this->_blUpdateBreak = d3install::getInstance()->performUpdateProcess(false, true);
|
||||
$this->_blError = d3install::getInstance()->getUpdateProcessErrorStatus();
|
||||
$this->_sErrorMsg = d3install::getInstance()->getUpdateProcessErrorMessage();
|
||||
$blStepByStep = true;
|
||||
$aActionList = d3install::getInstance()->performUpdateChecklist($blStepByStep);
|
||||
$this->_aUserSelections = d3install::getInstance()->getUserSelections();
|
||||
$this->aCheckList = $aActionList;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws d3ParameterNotFoundException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function manualyinstall()
|
||||
{
|
||||
if (! $this->hasDemoShopMode()) {
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew(d3install_updatebase::class);
|
||||
$oUpdateBase->resetUpdateSkipFlag();
|
||||
|
||||
$blExecute = Registry::get(Request::class)->getRequestEscapedParameter('setExecute') == 1 ? true : false;
|
||||
$blStepByStep = true;
|
||||
$this->setAction('manualyinstall');
|
||||
$this->_blUpdateBreak = d3install::getInstance()->performUpdateProcess($blStepByStep, $blExecute);
|
||||
$this->_blError = d3install::getInstance()->getUpdateProcessErrorStatus();
|
||||
$this->_sErrorMsg = d3install::getInstance()->getUpdateProcessErrorMessage();
|
||||
$aActionList = d3install::getInstance()->performUpdateChecklist($blStepByStep);
|
||||
$this->_aUserSelections = d3install::getInstance()->getUserSelections();
|
||||
$this->aCheckList = $aActionList;
|
||||
|
||||
if (false == count($this->aCheckList)) {
|
||||
$this->_sAction = 'skip';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getUserSelections()
|
||||
{
|
||||
return $this->_aUserSelections;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return $this->_sAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sAction
|
||||
*/
|
||||
public function setAction(string $sAction)
|
||||
{
|
||||
$this->_sAction = $sAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
if ($this->_blError) {
|
||||
$blStepByStep = true;
|
||||
$blUseBreak = true;
|
||||
$this->aCheckList = d3install::getInstance()->performUpdateChecklist($blStepByStep, $blUseBreak);
|
||||
}
|
||||
|
||||
return $this->_blError;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorMessageText()
|
||||
{
|
||||
if ($this->_sErrorMsg) {
|
||||
return sprintf(
|
||||
Registry::getLang()->translateString('D3_CFG_MOD_UPDATE_JOB_ERRORMSG_DESC'),
|
||||
$this->_sErrorMsg
|
||||
);
|
||||
} else {
|
||||
return Registry::getLang()->translateString('D3_CFG_MOD_UPDATE_JOB_ERROR_DESC');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getRefreshUrl()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if (d3install::getInstance()->getUpdateInstaller()->getModuleInstallations()) {
|
||||
$aParams = [
|
||||
'cl' => $this->getClassKey(),
|
||||
'formercl' => $this->getFormerClassName(),
|
||||
'formeritem' => $this->getFormerItem(),
|
||||
'fnc' => $this->getAction(),
|
||||
];
|
||||
$sURL = Registry::get(d3utils::class)->getAdminClassUrl($aParams);
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $sURL;
|
||||
} else {
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $this->getFormerClassUrl();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFormerClassName()
|
||||
{
|
||||
return Registry::get(Request::class)->getRequestEscapedParameter('formercl');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFormerItem()
|
||||
{
|
||||
return Registry::get(Request::class)->getRequestEscapedParameter('formeritem');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|string
|
||||
*/
|
||||
public function getFormerClassUrl()
|
||||
{
|
||||
$sSeparator = ini_get('arg_separator.output');
|
||||
$sHTMLSeparator = htmlspecialchars($sSeparator);
|
||||
|
||||
//&force_admin_sid='.oxRegistry::getSession()->getId().'&
|
||||
$sUrl = str_replace($sHTMLSeparator, $sSeparator, $this->getViewConfig()->getSelfLink() . 'cl=' . $this->getFormerClassName());
|
||||
|
||||
if ($this->getFormerItem()) {
|
||||
$sUrl .= $sSeparator.'item=' . $this->getFormerItem();
|
||||
}
|
||||
|
||||
return $sUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBackLinkText()
|
||||
{
|
||||
if ($this->getFormerClassName()) {
|
||||
return sprintf(
|
||||
Registry::getLang()->translateString('D3_CFG_MOD_UPDATE_NOUPDATEBACKLINK'),
|
||||
$this->getFormerClassUrl()
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getUpdateBreak()
|
||||
{
|
||||
return $this->_blUpdateBreak;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCheckList()
|
||||
{
|
||||
return $this->aCheckList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $mType
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCheckItemDesc($mType)
|
||||
{
|
||||
if (is_array($mType)) {
|
||||
$aKeys = array_keys($mType);
|
||||
$mType[$aKeys[0]] = Registry::getLang()->translateString(
|
||||
'D3_CFG_MOD_UPDATE_JOB_' . strtoupper($mType[$aKeys[0]])
|
||||
);
|
||||
return call_user_func_array('sprintf', $mType);
|
||||
} elseif (is_string($mType)) {
|
||||
return Registry::getLang()->translateString('D3_CFG_MOD_UPDATE_JOB_' . strtoupper($mType));
|
||||
}
|
||||
|
||||
return $mType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getHideSkip()
|
||||
{
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('blHideSkip') || false == $this->getFormerClassName()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUserMessages()
|
||||
{
|
||||
return $this->_aMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function hasSkipHashes()
|
||||
{
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew(d3install_updatebase::class);
|
||||
return $oUpdateBase->hasSkipHashs();
|
||||
}
|
||||
|
||||
public function delskiphashs()
|
||||
{
|
||||
/** @var d3install_updatebase $oUpdateBase */
|
||||
$oUpdateBase = oxNew(d3install_updatebase::class);
|
||||
$oUpdateBase->delSkipHashs();
|
||||
}
|
||||
|
||||
public function getHelpUrl()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStepCountMessage()
|
||||
{
|
||||
$iCount = Registry::getSession()->getVariable('iD3UpdatebaseCount');
|
||||
|
||||
if (false == $iCount || $iCount == '' || $iCount == 0) {
|
||||
$iCount = 1;
|
||||
}
|
||||
|
||||
$sText = sprintf(Registry::getLang()->translateString('D3_INSTALL_SETUPCOUNT'), $iCount);
|
||||
|
||||
if ($sDescText = Registry::getConfig()->getConfigParam('sD3UpdatebaseStepDesc')) {
|
||||
$sText .= sprintf(Registry::getLang()->translateString('D3_INSTALL_SETUPCOUNT_DESC'), $sDescText);
|
||||
Registry::getConfig()->setConfigParam('sD3UpdatebaseStepDesc', null);
|
||||
}
|
||||
|
||||
return $sText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flag if current view is an order view
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsOrderStep()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getModCfgUpdateRequiredMessage()
|
||||
{
|
||||
return d3install::getInstance()->getModCfgUpdateRequiredMessage();
|
||||
}
|
||||
}
|
429
Application/Controller/Admin/Install/d3mod_activation.php
Normal file
429
Application/Controller/Admin/Install/d3mod_activation.php
Normal file
@ -0,0 +1,429 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Install;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use D3\ModCfg\Application\Model\Shopcompatibility\d3shopversionconverter;
|
||||
use D3\ModCfg\Application\Model\d3str;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\ShopVersion;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Application\Model\Shop;
|
||||
|
||||
final class d3mod_activation extends d3_cfg_mod_main
|
||||
{
|
||||
protected $_sNextStep = 'getActivationType';
|
||||
protected $_sActivationType;
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/install/activation';
|
||||
protected $_blSubmitStatus = false;
|
||||
protected $_sModSerial = '';
|
||||
protected $_sNotSuccessMessage = '';
|
||||
protected $_sValidTo = '';
|
||||
/** @var d3_cfg_mod */
|
||||
protected $_oModule;
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->_oModule = d3_cfg_mod::get(Registry::get(Request::class)->getRequestEscapedParameter('modid'));
|
||||
$this->_sActivationType = Registry::get(Request::class)->getRequestEscapedParameter('activationtype');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('oModule', d3_cfg_mod::get(Registry::get(Request::class)->getRequestEscapedParameter('modid')));
|
||||
|
||||
return parent::render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function isLicenseRequired()
|
||||
{
|
||||
$blRet = true;
|
||||
|
||||
try {
|
||||
$blRet = $this->_oModule->isLicenseRequired();
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
}
|
||||
|
||||
return $blRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $module
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getModTitle(d3_cfg_mod $module)
|
||||
{
|
||||
try {
|
||||
$sModTitle = $module->getModTitle();
|
||||
} catch (d3_cfg_mod_exception) {
|
||||
$sModTitle = $module->getModBaseTitle();
|
||||
}
|
||||
|
||||
return $sModTitle;
|
||||
}
|
||||
|
||||
public function setStep1()
|
||||
{
|
||||
$this->_sNextStep = 'getActivationData';
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setStep2()
|
||||
{
|
||||
$aLicData = [];
|
||||
$this->_sNextStep = 'submitData';
|
||||
|
||||
$sKey = trim(Registry::get(Request::class)->getRequestEscapedParameter('licencekey'));
|
||||
if ($this->getActivationType() == 'boughtoxidmodule'
|
||||
&& strlen($sKey) > 32
|
||||
) {
|
||||
$this->_saveSerial($sKey);
|
||||
$this->_saveActIdent('');
|
||||
} else {
|
||||
if ($this->getActivationType() == 'requestagain') {
|
||||
$sKey = $this->_oModule->getActIdent();
|
||||
}
|
||||
/** @var d3shopversionconverter $oShopVersionConverter */
|
||||
$oShopVersionConverter = oxNew(d3shopversionconverter::class);
|
||||
$oLicServer = d3install::getInstance()->getFromLicenceServer();
|
||||
$oLicServer->setParameter('sModId', $this->_oModule->d3GetModId());
|
||||
$oLicServer->setParameter('sModVersion', $this->_oModule->getModVersion());
|
||||
$oLicServer->setParameter('sDomain', $this->getSubmitLicenceDomain());
|
||||
$oLicServer->setParameter('sShopEdition', $this->getSubmitShopEdition());
|
||||
$oLicServer->setParameter('sShopId', $this->getSubmitLicenceShop()->getId());
|
||||
$oLicServer->setParameter('sShopVersion', $oShopVersionConverter->fixVersionToDefaultEdition(
|
||||
ShopVersion::getVersion()
|
||||
));
|
||||
|
||||
if ($this->getActivationType() == 'usedemo') {
|
||||
$aLicData = $oLicServer->getDemoLicence();
|
||||
} elseif (
|
||||
$this->getActivationType() == 'boughtoxidmodule' ||
|
||||
$this->getActivationType() == 'requestagain'
|
||||
) {
|
||||
$oLicServer->setParameter('sActIdent', $sKey);
|
||||
$aLicData = $oLicServer->getModuleLicence();
|
||||
}
|
||||
|
||||
$this->_sModSerial = $aLicData['sSerial'];
|
||||
$this->_blSubmitStatus = $aLicData['iError'];
|
||||
$this->_sNotSuccessMessage = $aLicData['sErrMsg'];
|
||||
$this->_sValidTo = $aLicData['sValidTo'];
|
||||
|
||||
if ($this->_blSubmitStatus === '0' && $this->_sModSerial) {
|
||||
$this->_oModule->setSerial($this->_sModSerial);
|
||||
$this->_saveActIdent($sKey);
|
||||
$this->_oModule->save();
|
||||
}
|
||||
|
||||
$this->_sActivationType = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sLicKey
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
protected function _saveSerial($sLicKey)
|
||||
{
|
||||
$sModId = Registry::get(Request::class)->getRequestEscapedParameter('modid');
|
||||
|
||||
if ($sLicKey) {
|
||||
d3_cfg_mod::get($sModId)->setSerial($sLicKey);
|
||||
d3_cfg_mod::get($sModId)->save();
|
||||
$this->_sNextStep = 'saveSerialSuccess';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sActIdent
|
||||
*
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
protected function _saveActIdent($sActIdent)
|
||||
{
|
||||
$sModId = Registry::get(Request::class)->getRequestEscapedParameter('modid');
|
||||
|
||||
if ($sActIdent) {
|
||||
d3_cfg_mod::get($sModId)->setActIdent($sActIdent);
|
||||
d3_cfg_mod::get($sModId)->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNextStep()
|
||||
{
|
||||
return $this->_sNextStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getActivationType()
|
||||
{
|
||||
return $this->_sActivationType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSubmitLicenceDomain()
|
||||
{
|
||||
$oD3Str = oxNew(d3str::class);
|
||||
$aUrl = parse_url(strtolower(Registry::getConfig()->getConfigParam('sShopURL')));
|
||||
|
||||
if ($oD3Str->isIPNum($aUrl['host'])) {
|
||||
$sRegDomain = $aUrl['host'];
|
||||
} else {
|
||||
$tld = $oD3Str->getTLD($aUrl['host']);
|
||||
$sPattern = '@'.preg_quote('.'.$tld).'$@';
|
||||
$sCustDomain = $tld ? preg_replace($sPattern, '', $aUrl['host']) : $aUrl['host'];
|
||||
$aCustDomain = array_slice(explode('.', $sCustDomain), -1, 1);
|
||||
$sRegDomain = $aCustDomain[0]. ($oD3Str->getTLD($aUrl['host']) ? '.'.$tld : '');
|
||||
}
|
||||
|
||||
return $sRegDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Shop
|
||||
*/
|
||||
public function getSubmitLicenceShop()
|
||||
{
|
||||
/** @var Shop $shop */
|
||||
$shop = Registry::getConfig()->getActiveShop();
|
||||
return $shop;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $blFull
|
||||
* @return string
|
||||
*/
|
||||
public function getSubmitShopEdition($blFull = false)
|
||||
{
|
||||
if ($blFull) {
|
||||
return Registry::getConfig()->getFullEdition();
|
||||
} else {
|
||||
/** @var d3shopversionconverter $oShopVersionConverter */
|
||||
$oShopVersionConverter = oxNew(d3shopversionconverter::class);
|
||||
return $oShopVersionConverter->fixEditionToDefaultEdition($this->getShopEdition());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleSerial()
|
||||
{
|
||||
return $this->_sModSerial;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getSubmitStatus()
|
||||
{
|
||||
return $this->_blSubmitStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getNotSuccessMessage()
|
||||
{
|
||||
$sIdent = "D3_CFG_MOD_ACTIVATION_ERR";
|
||||
|
||||
match ($this->getSubmitStatus()) {
|
||||
'1' => $sIdent .= "MISSINGPARAMS",
|
||||
'2' => $sIdent .= "UNKNOWNMODULE",
|
||||
'3' => $sIdent .= "TOMUCHTESTLIC",
|
||||
'4' => $sIdent .= "NOORDER",
|
||||
'5' => $sIdent .= "WRONGEDITION",
|
||||
'6' => $sIdent .= "DIFFERENTSHOPS",
|
||||
'7' => $sIdent .= "NEWERMAJORVERSION",
|
||||
default => Registry::getLang()->translateString($sIdent),
|
||||
};
|
||||
|
||||
return Registry::getLang()->translateString($sIdent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getSubmitText()
|
||||
{
|
||||
$sTranslIdent = "D3_CFG_MOD_ACTIVATION_SUBMIT_NEXT";
|
||||
|
||||
switch ($this->getActivationType()) {
|
||||
case "boughtoxidmodule":
|
||||
case "requestagain":
|
||||
$sTranslIdent = "D3_CFG_MOD_ACTIVATION_SUBMIT_ACTNOW";
|
||||
break;
|
||||
case "boughtforeign":
|
||||
case "wantbuy":
|
||||
case "notlisted":
|
||||
$sTranslIdent = "D3_CFG_MOD_ACTIVATION_SUBMIT_BACK";
|
||||
break;
|
||||
case "usedemo":
|
||||
$sTranslIdent = "D3_CFG_MOD_ACTIVATION_SUBMIT_SETDEMO";
|
||||
break;
|
||||
}
|
||||
|
||||
return Registry::getLang()->translateString($sTranslIdent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLicenceExpireDate()
|
||||
{
|
||||
// unable to use date, because date in far future can't handle with php
|
||||
|
||||
$sDay = substr($this->_sValidTo, 8, 2);
|
||||
$sMonth = substr($this->_sValidTo, 5, 2);
|
||||
$sYear = substr($this->_sValidTo, 0, 4);
|
||||
|
||||
$sHour = substr($this->_sValidTo, 11, 2);
|
||||
$sMinute = substr($this->_sValidTo, 14, 2);
|
||||
$sSecond = substr($this->_sValidTo, 17, 2);
|
||||
|
||||
return "$sDay.$sMonth.$sYear $sHour:$sMinute:$sSecond";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasNoExpiration()
|
||||
{
|
||||
if ($this->_sValidTo == '2099-12-31 23:59:59' ||
|
||||
$this->_sValidTo == '2090-12-31 23:59:59'
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExpirationMessage()
|
||||
{
|
||||
if ($this->hasNoExpiration()) {
|
||||
return Registry::getLang()->translateString("D3_CFG_MOD_ACTIVATION_SUBMIT_SUCCESS_NOEXP").
|
||||
Registry::getLang()->translateString("D3_CFG_MOD_ACTIVATION_SUBMIT_SUCCESS_2");
|
||||
} else {
|
||||
return Registry::getLang()->translateString("D3_CFG_MOD_ACTIVATION_SUBMIT_SUCCESS_1")."<b>".
|
||||
$this->getLicenceExpireDate()."</b>".
|
||||
Registry::getLang()->translateString("D3_CFG_MOD_ACTIVATION_SUBMIT_SUCCESS_2");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string
|
||||
*/
|
||||
public function getBgColor()
|
||||
{
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('bgcolor')) {
|
||||
return Registry::get(Request::class)->getRequestEscapedParameter('bgcolor');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|false
|
||||
*/
|
||||
public function d3GetMenuItemTitle()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsOrderStep()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
57
Application/Controller/Admin/Log/d3_cfg_log.php
Normal file
57
Application/Controller/Admin/Log/d3_cfg_log.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Log;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
|
||||
class d3_cfg_log extends d3_cfg_mod_
|
||||
{
|
||||
protected $_hasListItems = true;
|
||||
|
||||
/**
|
||||
* d3_cfg_log constructor.
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws DBALException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
d3install::getInstance()->startUpdateFrame();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('sListClass', d3_cfg_log_list::class);
|
||||
$this->addTplParam('sMainClass', d3_cfg_log_main::class);
|
||||
|
||||
return parent::render();
|
||||
}
|
||||
}
|
79
Application/Controller/Admin/Log/d3_cfg_log_cleanup.php
Normal file
79
Application/Controller/Admin/Log/d3_cfg_log_cleanup.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Log;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
|
||||
class d3_cfg_log_cleanup extends d3_cfg_mod_main
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/log/cleanup';
|
||||
|
||||
protected $_sModId = 'd3modcfg_lib';
|
||||
|
||||
protected $_sMenuSubItemTitle = 'd3mxlog';
|
||||
|
||||
public function delete()
|
||||
{
|
||||
// geloescht wird ueber List-Klasse
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogTypeList()
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
|
||||
return $oLog->getLogTypeList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getModIdList()
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
|
||||
return $oLog->getModIdList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function d3getAdditionalFormParams()
|
||||
{
|
||||
$aParams = parent::d3getAdditionalFormParams();
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId')) {
|
||||
$aParams['sD3ModId'] = Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId');
|
||||
}
|
||||
|
||||
return $aParams;
|
||||
}
|
||||
}
|
201
Application/Controller/Admin/Log/d3_cfg_log_list.php
Normal file
201
Application/Controller/Admin/Log/d3_cfg_log_list.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Log;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\UtilsDate;
|
||||
|
||||
class d3_cfg_log_list extends d3_cfg_mod_list
|
||||
{
|
||||
protected $_sListClass = d3log::class;
|
||||
|
||||
protected $_sDefSortField = 'oxcounter';
|
||||
|
||||
protected $_blDesc = true;
|
||||
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/log/list';
|
||||
|
||||
// enable language depended configuration
|
||||
protected $_blD3ShowLangSwitch = false;
|
||||
|
||||
protected $_blShowListItems = true;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sPwrSearchFld = Registry::get(Request::class)->getRequestEscapedParameter("pwrsearchfld");
|
||||
|
||||
if (false == isset($sPwrSearchFld)) {
|
||||
$sPwrSearchFld = "oxaction";
|
||||
}
|
||||
|
||||
/** @var d3log $oD3Log */
|
||||
$oD3Log = null;
|
||||
$oList = $this->getItemList();
|
||||
|
||||
$this->_aViewData["art_category"] = null;
|
||||
$this->_aViewData["_act"] = null;
|
||||
$this->_aViewData["readonly"] = false;
|
||||
$this->_aViewData["folder"] = false;
|
||||
|
||||
if ($oList) {
|
||||
/**
|
||||
* @var int $key
|
||||
* @var d3log $oD3Log
|
||||
*/
|
||||
foreach ($oList as $key => $oD3Log) {
|
||||
$sFieldName = "d3log__" . strtolower($sPwrSearchFld);
|
||||
|
||||
// formatting view
|
||||
if (false == Registry::getConfig()->getConfigParam('blSkipFormatConversion')) {
|
||||
$oConvertInstance = Registry::get(UtilsDate::class);
|
||||
if ($oD3Log->$sFieldName->fldtype == "datetime") {
|
||||
$oConvertInstance->convertDBDateTime($oD3Log->$sFieldName);
|
||||
} elseif ($oD3Log->$sFieldName->fldtype == "timestamp") {
|
||||
$oConvertInstance->convertDBTimestamp($oD3Log->$sFieldName);
|
||||
} elseif ($oD3Log->$sFieldName->fldtype == "date") {
|
||||
$oConvertInstance->convertDBDate($oD3Log->$sFieldName);
|
||||
}
|
||||
}
|
||||
|
||||
$oD3Log->pwrsearchval = $oD3Log->$sFieldName->value;
|
||||
$oList[$key] = $oD3Log;
|
||||
}
|
||||
}
|
||||
|
||||
$sRet = parent::render();
|
||||
|
||||
// load fields
|
||||
if (! $oD3Log && $oList) {
|
||||
/** @var d3log $oD3Log */
|
||||
$oD3Log = $oList->getBaseObject();
|
||||
}
|
||||
|
||||
$this->addTplParam('pwrsearchfields', $oD3Log->getSearchableFields());
|
||||
$this->addTplParam('pwrsearchfld', strtoupper($sPwrSearchFld));
|
||||
|
||||
if ($this->getViewDataElement('where')) {
|
||||
$oTmp = $this->getViewDataElement('where');
|
||||
$sFieldName = "d3log__" . strtoupper($sPwrSearchFld);
|
||||
if (isset($oTmp->$sFieldName)) {
|
||||
$this->addTplParam('pwrsearchinput', $oTmp->$sFieldName);
|
||||
}
|
||||
}
|
||||
|
||||
$aFilter = $this->getListFilter();
|
||||
$this->addTplParam('pwrsearchinput', $aFilter["d3log"][$sPwrSearchFld] ?? null);
|
||||
|
||||
$this->addTplParam('default_edit', d3_cfg_log_main::class);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function buildWhere()
|
||||
{
|
||||
$this->_aWhere = parent::buildWhere();
|
||||
if (false == is_array($this->_aWhere)) {
|
||||
$this->_aWhere = [];
|
||||
}
|
||||
|
||||
$this->_aWhere['d3log.oxshopid'] = Registry::getConfig()->getShopId() ?: Registry::getSession()->getVariable("actshop");
|
||||
|
||||
if ((false == isset($this->_aWhere['d3log.oxmodid']) || false == $this->_aWhere['d3log.oxmodid'])
|
||||
&& Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId')
|
||||
) {
|
||||
$this->_aWhere['d3log.oxmodid'] = '%' . Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId') . '%';
|
||||
} elseif ((false == isset($this->_aWhere['d3log.oxmodid']) || false == $this->_aWhere['d3log.oxmodid'])
|
||||
&& $this->_sModId
|
||||
) {
|
||||
$this->_aWhere['d3log.oxmodid'] = '%' . $this->_sModId . '%';
|
||||
}
|
||||
|
||||
return $this->_aWhere;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sModId
|
||||
*
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogTypeList($sModId = '')
|
||||
{
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId')) {
|
||||
$sModId = Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId');
|
||||
}
|
||||
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
|
||||
return $oLog->getLogTypeList($sModId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sModId
|
||||
*
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getModIdList($sModId = '')
|
||||
{
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId')) {
|
||||
$sModId = Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId');
|
||||
}
|
||||
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
|
||||
return $oLog->getModIdList($sModId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function deleteentry()
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
$oLog->delLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function d3getAdditionalFormParams()
|
||||
{
|
||||
$aParams = parent::d3getAdditionalFormParams();
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId')) {
|
||||
$aParams['sD3ModId'] = Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId');
|
||||
}
|
||||
|
||||
return $aParams;
|
||||
}
|
||||
}
|
321
Application/Controller/Admin/Log/d3_cfg_log_main.php
Normal file
321
Application/Controller/Admin/Log/d3_cfg_log_main.php
Normal file
@ -0,0 +1,321 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Log;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\d3database;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use DateTime;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Application\Model\Shop;
|
||||
use OxidEsales\Eshop\Core\Email;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\UtilsView;
|
||||
|
||||
class d3_cfg_log_main extends d3_cfg_mod_main
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/log/main';
|
||||
|
||||
protected $_sModId = 'd3modcfg_lib';
|
||||
|
||||
protected $_sMenuSubItemTitle = 'd3mxlog';
|
||||
|
||||
public $sExportPath = "export/";
|
||||
|
||||
/** @var d3log */
|
||||
public $oLog;
|
||||
|
||||
protected $_aExportNaviItems = [
|
||||
'new' => [
|
||||
'sScript' => 'top.basefrm.list.EditThis(-1);return false;',
|
||||
'sTranslationId' => 'D3_CFG_EXPORT_SHOWDIALOG',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->oLog = oxNew(d3log::class);
|
||||
|
||||
$this->addTplParam('deftime', (new DateTime('1 week ago'))->format('Y-m-d H:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('edit', $this->oLog);
|
||||
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
|
||||
if (isset($soxId) && $soxId && $soxId != "-1") {
|
||||
// load object
|
||||
$this->oLog->load($soxId);
|
||||
$this->_aNaviItems = $this->_aExportNaviItems;
|
||||
}
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aParams
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function addDefaultValues($aParams)
|
||||
{
|
||||
return $aParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sModId
|
||||
*
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
public function getItemCount($sModId = '')
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
return $oLog->getItemCount($sModId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getLogInfoMessage()
|
||||
{
|
||||
$sMessage = '';
|
||||
$sModId = Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId');
|
||||
|
||||
if ($sModId) {
|
||||
$sMessage .= sprintf(
|
||||
Registry::getLang()->translateString('D3_CFG_LOG_ACTITEMS_MODULES'),
|
||||
d3_cfg_mod::get($sModId)->getModTitle()
|
||||
);
|
||||
}
|
||||
|
||||
$sMessage .= Registry::getLang()->translateString('D3_CFG_LOG_ACTITEMS') . $this->getItemCount($sModId);
|
||||
|
||||
if ($this->getItemCount($sModId) > 100) {
|
||||
$sMessage .= Registry::getLang()->translateString('D3_CFG_LOG_ACTITEMS2');
|
||||
} else {
|
||||
$sMessage .= Registry::getLang()->translateString('D3_CFG_LOG_ACTITEMS1');
|
||||
}
|
||||
|
||||
return $sMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function d3getAdditionalFormParams()
|
||||
{
|
||||
$aParams = parent::d3getAdditionalFormParams();
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId')) {
|
||||
$aParams['sD3ModId'] = Registry::get(Request::class)->getRequestEscapedParameter('sD3ModId');
|
||||
}
|
||||
|
||||
return $aParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getModIdList()
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
|
||||
$aParams = $this->d3getAdditionalFormParams();
|
||||
$sModId = is_array($aParams) && isset($aParams['sD3ModId']) ? $aParams['sD3ModId'] : '';
|
||||
|
||||
return $oLog->getModIdList($sModId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getClassList()
|
||||
{
|
||||
/** @var d3log $oLog */
|
||||
$oLog = oxNew(d3log::class);
|
||||
|
||||
$aParams = $this->d3getAdditionalFormParams();
|
||||
$sModId = is_array($aParams) && isset($aParams['sD3ModId']) ? $aParams['sD3ModId'] : '';
|
||||
|
||||
return $oLog->getClassList($sModId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function d3logexport_sql()
|
||||
{
|
||||
$aParams = $this->d3getAdditionalFormParams();
|
||||
$sModId = is_array($aParams) && isset($aParams['sD3ModId']) ? $aParams['sD3ModId'] : '';
|
||||
|
||||
/** @var d3database $oD3DataBase */
|
||||
$oD3DataBase = d3database::getInstance();
|
||||
$sContent = $oD3DataBase->getExportSqlByQuery(
|
||||
$this->oLog->d3BuildExportQuery($sModId),
|
||||
$this->oLog->getCoreTableName()
|
||||
);
|
||||
|
||||
/** @var d3filesystem $oFS */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('export_mail')) {
|
||||
$sPath = $oFS->trailingslashit(Registry::getConfig()->getConfigParam('sShopDir')) . $oFS->trailingslashit(
|
||||
$this->sExportPath
|
||||
) . 'd3log.sql';
|
||||
$oFS->createFile($sPath, $sContent);
|
||||
$this->addTplParam('sExportPath', $sPath);
|
||||
|
||||
$aPath = $oFS->splitPath($sPath);
|
||||
$this->_sendFileViaMail($aPath);
|
||||
} else {
|
||||
$oFS->startDirectDownload('d3log.sql', $sContent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function d3logexport_csv()
|
||||
{
|
||||
/** @var d3database $oD3DataBase */
|
||||
$oD3DataBase = d3database::getInstance();
|
||||
$sContent = $oD3DataBase->getExportCsvByQuery($this->oLog->d3BuildExportQuery());
|
||||
|
||||
/** @var d3filesystem $oFS */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('export_mail')) {
|
||||
$sPath = $oFS->trailingslashit(Registry::getConfig()->getConfigParam('sShopDir')) . $oFS->trailingslashit(
|
||||
$this->sExportPath
|
||||
) . 'd3log.csv';
|
||||
$oFS->createFile($sPath, $sContent);
|
||||
$this->addTplParam('sExportPath', $sPath);
|
||||
|
||||
$aPath = $oFS->splitPath($sPath);
|
||||
$this->_sendFileViaMail($aPath);
|
||||
} else {
|
||||
$oFS->startDirectDownload('d3log.csv', $sContent);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aPath
|
||||
*/
|
||||
protected function _sendFileViaMail($aPath)
|
||||
{
|
||||
$aErrors = Registry::getSession()->getVariable('Errors');
|
||||
$sMailAdr = Registry::get(Request::class)->getRequestEscapedParameter('export_mail');
|
||||
$this->addTplParam('mail', $sMailAdr);
|
||||
|
||||
if ($sMailAdr && ! count($aErrors['default'])) {
|
||||
/** @var Shop $oActShop */
|
||||
$oActShop = oxNew(Shop::class);
|
||||
$oActShop->load(Registry::getConfig()->getShopId());
|
||||
/** @var Email $oEmail */
|
||||
$oEmail = oxNew(Email::class);
|
||||
$oEmail->setSubject(Registry::getLang()->translateString('D3_LOG_MAIL_SUBJECT'));
|
||||
$oEmail->setRecipient($sMailAdr);
|
||||
$oEmail->setReplyTo($oActShop->getFieldData('oxinfoemail'), $oActShop->getFieldData('oxname'));
|
||||
$oEmail->setFrom($oActShop->getFieldData('oxinfoemail'), $oActShop->getFieldData('oxname'));
|
||||
$oEmail->addAttachment($aPath['dir'] . $aPath['file'], $aPath['file']);
|
||||
|
||||
if ($oEmail->send()) {
|
||||
$this->addTplParam('blMailSend', true);
|
||||
} else {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(
|
||||
new StandardException(sprintf(
|
||||
Registry::getLang()->translateString('D3_LOG_MAIL_NOTSEND'),
|
||||
implode('', $aPath)
|
||||
))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getAllItemsTranslation()
|
||||
{
|
||||
$aParams = $this->d3getAdditionalFormParams();
|
||||
$sTitle = false;
|
||||
if (is_array($aParams) && isset($aParams['sD3ModId'])) {
|
||||
/** @var d3_cfg_mod $oCfgMod */
|
||||
$oCfgMod = d3_cfg_mod::get($aParams['sD3ModId']);
|
||||
$sTitle = $oCfgMod->getModTitle($aParams['sD3ModId']);
|
||||
}
|
||||
|
||||
return $sTitle ?
|
||||
sprintf(Registry::getLang()->translateString('D3_CFG_EXPORT_EXP_MODULE_DEF'), $sTitle) :
|
||||
Registry::getLang()->translateString('D3_CFG_EXPORT_EXP_MODULE_ALL');
|
||||
}
|
||||
}
|
198
Application/Controller/Admin/Maintenance/d3cfgitems.php
Normal file
198
Application/Controller/Admin/Maintenance/d3cfgitems.php
Normal file
@ -0,0 +1,198 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\d3utils;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
|
||||
class d3cfgitems extends d3_cfg_mod_main
|
||||
{
|
||||
public $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/maintenance/cfgitems';
|
||||
protected $_sMenuSubItemTitle = 'd3mxsysitems';
|
||||
protected $_blEditMode = false;
|
||||
/** @var d3filesystem */
|
||||
public $oFS;
|
||||
protected $_aFiles = [
|
||||
'config' => [
|
||||
'sFileName' => 'config.inc.php',
|
||||
'blWriteProtected' => true,
|
||||
],
|
||||
'custconfig' => [
|
||||
'sFileName' => 'cust_config.inc.php',
|
||||
'blWriteProtected' => true,
|
||||
],
|
||||
'd3custconfig' => [
|
||||
'sFileName' => 'd3cust_config.inc.php',
|
||||
'blWriteProtected' => true,
|
||||
],
|
||||
'functions' => [
|
||||
'sFileName' => 'modules/functions.php',
|
||||
'blWriteProtected' => false,
|
||||
],
|
||||
'env' => [
|
||||
'sFileName' => '../.env',
|
||||
'blWriteProtected' => false,
|
||||
],
|
||||
];
|
||||
public $blSaveRet;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws DBALException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if (Registry::get(d3utils::class)->hasDemoshopMode()) {
|
||||
$mTplParam = Registry::getLang()->translateString('D3_CFG_CFGITEM_DEMOTEXT');
|
||||
} else {
|
||||
$this->oFS = oxNew(d3filesystem::class);
|
||||
$mTplParam = $this->blSaveRet === false ?
|
||||
Registry::get(Request::class)->getRequestEscapedParameter('newcfg') :
|
||||
file_get_contents($this->getFileName());
|
||||
//$this->oFS->readFile($this->getFileName());
|
||||
}
|
||||
|
||||
$this->addTplParam('sCfgContent', $mTplParam);
|
||||
$this->addTplParam('sFileSelect', Registry::get(Request::class)->getRequestEscapedParameter('sFileSelect'));
|
||||
|
||||
return parent::render();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getEditableFiles()
|
||||
{
|
||||
return $this->_aFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $sFileId
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName($sFileId = false)
|
||||
{
|
||||
$sSelectedFileId = $sFileId ?: Registry::get(Request::class)->getRequestEscapedParameter('sFileSelect');
|
||||
|
||||
if (false == $sSelectedFileId) {
|
||||
$aFileKeys = array_keys($this->getEditableFiles());
|
||||
$sSelectedFileId = $aFileKeys[0];
|
||||
}
|
||||
|
||||
if (false == $this->oFS) {
|
||||
$this->oFS = oxNew(d3filesystem::class);
|
||||
}
|
||||
$sFile = $this->oFS->trailingslashit(Registry::getConfig()->getConfigParam('sShopDir')) .
|
||||
$this->_aFiles[$sSelectedFileId]['sFileName'];
|
||||
|
||||
return $sFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getWritePermission()
|
||||
{
|
||||
if (false == $this->oFS) {
|
||||
$this->oFS = oxNew(d3filesystem::class);
|
||||
}
|
||||
|
||||
if (is_writable($this->getFileName())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if (false == Registry::get(d3utils::class)->hasDemoshopMode()) {
|
||||
$this->blSaveRet = false;
|
||||
|
||||
if (false == $this->oFS) {
|
||||
$this->oFS = oxNew(d3filesystem::class);
|
||||
}
|
||||
$sContent = Registry::get(Request::class)->getRequestEscapedParameter('newcfg');
|
||||
|
||||
if ($this->hasRequiredWriteProtection()) {
|
||||
$sPermission = 0444;
|
||||
} else {
|
||||
$sPermission = 0644;
|
||||
}
|
||||
|
||||
if ($this->oFS->chmod($this->getFileName(), 0644)) {
|
||||
$this->blSaveRet = $this->oFS->createFile($this->getFileName(), $sContent, true, $sPermission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function editFile()
|
||||
{
|
||||
if (false == Registry::get(d3utils::class)->hasDemoshopMode()) {
|
||||
$this->_blEditMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isWriteable()
|
||||
{
|
||||
if ($this->_blEditMode === true) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasRequiredWriteProtection()
|
||||
{
|
||||
$sFileId = Registry::get(Request::class)->getRequestEscapedParameter('sFileSelect');
|
||||
|
||||
if (false == $sFileId) {
|
||||
$aFileKeys = array_keys($this->getEditableFiles());
|
||||
$sFileId = $aFileKeys[0];
|
||||
}
|
||||
|
||||
return $this->_aFiles[$sFileId]['blWriteProtected'];
|
||||
}
|
||||
}
|
503
Application/Controller/Admin/Maintenance/d3cleartmp.php
Normal file
503
Application/Controller/Admin/Maintenance/d3cleartmp.php
Normal file
@ -0,0 +1,503 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\FileSizeFormatter;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use D3\ModCfg\Application\Model\d3utils;
|
||||
use D3\ModCfg\Application\Model\Maintenance\d3clrtmp;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\UtilsView;
|
||||
|
||||
class d3cleartmp extends d3_cfg_mod_main
|
||||
{
|
||||
public $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/maintenance/cleartmp';
|
||||
protected $_sMenuSubItemTitle = 'd3mxd3cleartmp';
|
||||
protected $_sModId = 'd3modcfg_lib';
|
||||
private bool $_blIsTicker = false;
|
||||
protected $_sTickerUrl = null;
|
||||
/** @var d3filesystem */
|
||||
public $oFS = null;
|
||||
/** @var d3clrtmp */
|
||||
public $oClrTmp;
|
||||
|
||||
/**
|
||||
* d3cleartmp constructor.
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
d3install::getInstance()->startUpdateFrame();
|
||||
|
||||
$this->addTplParam('clearModule', false);
|
||||
$this->addTplParam('clearSeo', false);
|
||||
$this->addTplParam('clearViews', false);
|
||||
$this->addTplParam('clearAll', false);
|
||||
$this->addTplParam('clearClassPath', false);
|
||||
$this->addTplParam('clearFrontend', false);
|
||||
$this->addTplParam('clearStructure', false);
|
||||
$this->addTplParam('clearDB', false);
|
||||
$this->addTplParam('clearLang', false);
|
||||
$this->addTplParam('clearTagcloud', false);
|
||||
$this->addTplParam('clearMenu', false);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
Registry::getConfig()->getActiveView()->addTplParam(
|
||||
'blShopIsProductive',
|
||||
Registry::getConfig()->isProductiveMode()
|
||||
);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|d3_cfg_mod|false
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DBALException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function d3GetSet()
|
||||
{
|
||||
return d3_cfg_mod::get($this->_d3GetModId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function setDevelopmentMode()
|
||||
{
|
||||
$this->d3GetSet()->prepareSaveData();
|
||||
$this->d3GetSet()->save();
|
||||
}
|
||||
|
||||
public function startTicker()
|
||||
{
|
||||
$this->_generateTickerUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function clearTmp()
|
||||
{
|
||||
$oClrTmp = $this->_getClrTmp();
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearall')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearAll', true);
|
||||
$blReturn = $oClrTmp->clearAllCache();
|
||||
} else {
|
||||
$blReturn = $this->_clearCacheParts($oClrTmp);
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearviewcache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearViews', true);
|
||||
$blClrTmp = $oClrTmp->updateViews();
|
||||
if (true === $blClrTmp) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3_CFG_CLRTMP_VIEWUPDATESUCCESS'));
|
||||
} elseif (false === $blClrTmp) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3_CFG_CLRTMP_VIEWUPDATENOSUCCESS'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($blReturn) {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3_CFG_CLRTMP_SUCCESS'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTmpPath()
|
||||
{
|
||||
return Registry::getConfig()->getConfigParam('sCompileDir');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTmpSize(): string
|
||||
{
|
||||
return (oxNew(FileSizeFormatter::class))->format($this->oFS->dirsize($this->getTmpPath()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTmpCount()
|
||||
{
|
||||
return $this->_getFileSystemHandler()->filecount($this->getTmpPath());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function getHelpUrl()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3filesystem
|
||||
*/
|
||||
protected function _getFileSystemHandler()
|
||||
{
|
||||
if (false == $this->oFS) {
|
||||
$this->oFS = oxNew(d3filesystem::class);
|
||||
}
|
||||
|
||||
return $this->oFS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3clrtmp
|
||||
*/
|
||||
protected function _getClrTmp()
|
||||
{
|
||||
if (false == $this->oClrTmp) {
|
||||
$this->oClrTmp = oxNew(d3clrtmp::class);
|
||||
}
|
||||
|
||||
return $this->oClrTmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function hasTicker()
|
||||
{
|
||||
$iThreshold = $this->getTickerThreshold();
|
||||
|
||||
if ($this->getTmpCount() >= $iThreshold) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|mixed
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getTickerThreshold()
|
||||
{
|
||||
return $this->d3GetSet()->getValue('iClrTmp_tickerThreshold') ?: 50000;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $iSlot
|
||||
* @return bool|mixed
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getUserDefinedAction($iSlot)
|
||||
{
|
||||
if ($this->d3GetSet()->getValue('sClrTmp_useraction' . $iSlot . 'name') &&
|
||||
$this->d3GetSet()->getValue('sClrTmp_useraction' . $iSlot . 'pattern')
|
||||
) {
|
||||
return $this->d3GetSet()->getValue('sClrTmp_useraction' . $iSlot . 'name');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $iStep
|
||||
*/
|
||||
protected function _generateTickerUrl($iStep = null)
|
||||
{
|
||||
// $oSession = oxRegistry::getSession();
|
||||
$aParams = [];
|
||||
|
||||
$aParams['cl'] = 'd3cleartmp';
|
||||
$aParams['remoteaccess'] = 'true';
|
||||
$aParams['fnc'] = 'clrtmpticker';
|
||||
$aParams['iLimitTimeStamp'] =
|
||||
Registry::get(Request::class)->getRequestEscapedParameter('iLimitTimeStamp') ?: time();
|
||||
|
||||
if ($iStep) {
|
||||
$aParams['istep'] = $iStep;
|
||||
}
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearall')) {
|
||||
$aParams['clearall'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearAll', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearfrontend')) {
|
||||
$aParams['clearfrontend'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearFrontend', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('cleardbcache')) {
|
||||
$aParams['cleardbcache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearDB', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearlangcache')) {
|
||||
$aParams['clearlangcache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearLang', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearmenucache')) {
|
||||
$aParams['clearmenucache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearMenu', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearclasspathcache')) {
|
||||
$aParams['clearclasspathcache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearClassPath', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearstructurecache')) {
|
||||
$aParams['clearstructurecache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearStructure', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('cleartagcloudcache')) {
|
||||
$aParams['cleartagcloudcache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearTagcloud', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearuser1cache')) {
|
||||
$aParams['clearuser1cache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearUser1', true);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearuser2cache')) {
|
||||
$aParams['clearuser2cache'] = 1;
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearUser2', true);
|
||||
}
|
||||
|
||||
$blUseRemoteToken = true;
|
||||
$sUrl = Registry::get(d3utils::class)->getAdminClassUrl($aParams, $blUseRemoteToken);
|
||||
$this->_sTickerUrl = $sUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function clrtmpticker()
|
||||
{
|
||||
$iLimitTimeStamp =
|
||||
Registry::get(Request::class)->getRequestEscapedParameter('iLimitTimeStamp') ?: time();
|
||||
|
||||
$oClrTmp = $this->_getClrTmp();
|
||||
$oClrTmp->setLimit(200, $iLimitTimeStamp);
|
||||
|
||||
$this->_blIsTicker = true;
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearall')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearAll', true);
|
||||
$blReturn = $oClrTmp->clearAllCache();
|
||||
} else {
|
||||
$blReturn = $this->_clearCacheParts($oClrTmp);
|
||||
}
|
||||
|
||||
if ($blReturn) {
|
||||
$this->_generateTickerUrl();
|
||||
}
|
||||
$this->_sendTickerOutput($this->_sTickerUrl);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isTicker()
|
||||
{
|
||||
return $this->_blIsTicker;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getTickerUrl()
|
||||
{
|
||||
return $this->_sTickerUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sRefreshURL
|
||||
*/
|
||||
protected function _sendTickerOutput($sRefreshURL)
|
||||
{
|
||||
// ToDo: move to template
|
||||
echo "<html>";
|
||||
echo "<head>";
|
||||
echo "<title>Clear Tmp Processing</title>";
|
||||
|
||||
if ($sRefreshURL) {
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; URL=$sRefreshURL\">";
|
||||
}
|
||||
|
||||
echo "</head><body style='font: 12px Trebuchet MS,Tahoma,Verdana,Arial,Helvetica,sans-serif;'>";
|
||||
echo "<br><br>Processing: " . $this->getTmpCount() . " übrige Dateien / files remained<br>";
|
||||
|
||||
if ($sRefreshURL) {
|
||||
echo "<br><span style='font-weight: bold;'>Please wait...</span>";
|
||||
} else {
|
||||
echo "<br><span style='font-weight: bold;'>Finished.</span>";
|
||||
}
|
||||
|
||||
echo "</body></html>";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function _d3GetModId()
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3clrtmp $oClrTmp
|
||||
*
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
protected function _clearCacheParts(d3clrtmp $oClrTmp)
|
||||
{
|
||||
$blReturn = false;
|
||||
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearfrontend')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearFrontend', true);
|
||||
$blReturn = $oClrTmp->clearFrontendCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('cleardbcache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearDB', true);
|
||||
$blReturn = $oClrTmp->clearDataBaseStructCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearlangcache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearLang', true);
|
||||
$blReturn = $oClrTmp->clearLangCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearmenucache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearMenu', true);
|
||||
$blReturn = $oClrTmp->clearMenuCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearclasspathcache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearClassPath', true);
|
||||
$blReturn = $oClrTmp->clearClassPathCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearstructurecache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearStructure', true);
|
||||
$blReturn = $oClrTmp->clearStructureCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('cleartagcloudcache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearTagcloud', true);
|
||||
$blReturn = $oClrTmp->clearTagcloudCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearseocache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearSeo', true);
|
||||
$blReturn = $oClrTmp->clearSeoCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearmodulecache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearModule', true);
|
||||
$blReturn = $oClrTmp->clearModuleCache();
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearuser1cache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearUser1', true);
|
||||
$blReturn = $oClrTmp->clearUserCache(1);
|
||||
}
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('clearuser2cache')) {
|
||||
Registry::getConfig()->getActiveView()->addTplParam('clearUser2', true);
|
||||
$blReturn = $oClrTmp->clearUserCache(2);
|
||||
}
|
||||
|
||||
return $blReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function d3ExecCommand1()
|
||||
{
|
||||
/** @var d3clrtmp $oClrTmp */
|
||||
$oClrTmp = oxNew(d3clrtmp::class);
|
||||
$oClrTmp->d3ExecCommand(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function d3ExecCommand2()
|
||||
{
|
||||
/** @var d3clrtmp $oClrTmp */
|
||||
$oClrTmp = oxNew(d3clrtmp::class);
|
||||
$oClrTmp->d3ExecCommand(2);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
|
||||
|
||||
/**
|
||||
* Class d3modlib
|
||||
*/
|
||||
class d3cleartmp_frame extends d3_cfg_mod_
|
||||
{
|
||||
protected $_hasListItems = false;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('sListClass', d3cleartmp_list::class);
|
||||
$this->addTplParam('sMainClass', d3cleartmp::class);
|
||||
return parent::render();
|
||||
}
|
||||
}
|
33
Application/Controller/Admin/Maintenance/d3cleartmp_list.php
Normal file
33
Application/Controller/Admin/Maintenance/d3cleartmp_list.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
|
||||
|
||||
class d3cleartmp_list extends d3_cfg_mod_list
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('blShowLangSwitch', false);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
}
|
63
Application/Controller/Admin/Maintenance/d3maintenance.php
Normal file
63
Application/Controller/Admin/Maintenance/d3maintenance.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use OxidEsales\Eshop\Application\Model\Shop;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\ActiveModulesDataProviderBridgeInterface;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Bridge\ModuleActivationBridge;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Bridge\ModuleActivationBridgeInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3maintenance extends d3_cfg_mod_main
|
||||
{
|
||||
public $_sThisTemplate = 'd3maintenance.tpl';
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function repairModuleDbItems()
|
||||
{
|
||||
$aActiveModules = ContainerFactory::getInstance()->getContainer()->get(ActiveModulesDataProviderBridgeInterface::class)->getModuleIds();
|
||||
|
||||
$aRemoveFields = ['aDisabledModules', 'aModulePaths', 'aModuleTemplates', 'aModuleVersions',
|
||||
'aModuleEvents', 'aModules', 'aModuleFiles'];
|
||||
|
||||
/** @var Shop $shop */
|
||||
$shop = Registry::getConfig()->getActiveShop();
|
||||
$container = ContainerFactory::getInstance()->getContainer();
|
||||
$queryBuilder = $container->get(QueryBuilderFactoryInterface::class)->create();
|
||||
$queryBuilder->delete('oxconfig')
|
||||
->where("oxvarname IN ('".implode("','", $aRemoveFields)."'")
|
||||
->andWhere('oxshopid = '.$queryBuilder->createNamedParameter($shop->getId()));
|
||||
|
||||
$queryBuilder->execute();
|
||||
|
||||
foreach ($aActiveModules as $moduleId) {
|
||||
/** @var ModuleActivationBridge $moduleActivationBridge */
|
||||
$moduleActivationBridge = $container->get(ModuleActivationBridgeInterface::class);
|
||||
$moduleActivationBridge->activate(
|
||||
$moduleId,
|
||||
Registry::getConfig()->getShopId()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
111
Application/Controller/Admin/Maintenance/d3shopmaintenance.php
Normal file
111
Application/Controller/Admin/Maintenance/d3shopmaintenance.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use Assert\Assert;
|
||||
use Assert\InvalidArgumentException;
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Maintenance\Actions\ActionInterface;
|
||||
use D3\ModCfg\Application\Model\Maintenance\d3maintenanceactions;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use ReflectionException;
|
||||
|
||||
class d3shopmaintenance extends d3_cfg_mod_main
|
||||
{
|
||||
public $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/maintenance/shopmaintenance';
|
||||
protected $_sMenuSubItemTitle = 'd3tbclclr_mtn';
|
||||
protected $_sModId = 'd3modcfg_lib';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws ReflectionException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render(): string
|
||||
{
|
||||
$sRet = parent::render();
|
||||
$this->addTplParam(
|
||||
'aCheckResults',
|
||||
$this->getMaintenanceActions()->getCheckResults()
|
||||
);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
public function checkItems(): void
|
||||
{
|
||||
$this->getMaintenanceActions()->checkAllActions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3maintenanceactions
|
||||
*/
|
||||
public function getMaintenanceActions(): d3maintenanceactions
|
||||
{
|
||||
return oxNew(d3maintenanceactions::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function _d3GetModId(): string
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function tidy(): void
|
||||
{
|
||||
try {
|
||||
$action = $this->getActionFromParameter();
|
||||
$action->fixIt();
|
||||
Registry::getSession()->deleteVariable('aD3ShopMaintenanceResults');
|
||||
} catch (InvalidArgumentException $invalid_argument_exception) {
|
||||
Registry::getLogger()->error($invalid_argument_exception, $_REQUEST);
|
||||
Registry::getUtilsView()->addErrorToDisplay($invalid_argument_exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ActionInterface
|
||||
*/
|
||||
protected function getActionFromParameter(): ActionInterface
|
||||
{
|
||||
$maintenanceController = oxNew(d3maintenanceactions::class);
|
||||
$list = array_change_key_case($maintenanceController->getActionList());
|
||||
$request = strtolower(Registry::getRequest()->getRequestEscapedParameter('action'));
|
||||
|
||||
Assert::that($request)->inArray(array_keys($list), Registry::getLang()->translateString('D3_CFG_CLRTMP_UNKNOWN_ACTION'));
|
||||
Assert::that($list[$request])->classExists();
|
||||
$action = oxNew($list[$request]);
|
||||
Assert::that($action)->isInstanceOf(ActionInterface::class);
|
||||
return $action;
|
||||
}
|
||||
}
|
56
Application/Controller/Admin/Maintenance/d3sysitems.php
Normal file
56
Application/Controller/Admin/Maintenance/d3sysitems.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
|
||||
class d3sysitems extends d3_cfg_mod_
|
||||
{
|
||||
protected $_hasListItems = false;
|
||||
|
||||
/**
|
||||
* d3sysitems constructor.
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws DBALException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
d3install::getInstance()->startUpdateFrame();
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('sListClass', d3sysitems_list::class);
|
||||
$this->addTplParam('sMainClass', d3cfgitems::class);
|
||||
return parent::render();
|
||||
}
|
||||
}
|
33
Application/Controller/Admin/Maintenance/d3sysitems_list.php
Normal file
33
Application/Controller/Admin/Maintenance/d3sysitems_list.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\Maintenance;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
|
||||
|
||||
class d3sysitems_list extends d3_cfg_mod_list
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('blShowLangSwitch', false);
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
}
|
33
Application/Controller/Admin/TPLBlocks/d3tplblocks.php
Normal file
33
Application/Controller/Admin/TPLBlocks/d3tplblocks.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\TPLBlocks;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_;
|
||||
|
||||
class d3tplblocks extends d3_cfg_mod_
|
||||
{
|
||||
protected $_hasListItems = true;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$this->addTplParam('sListClass', d3tplblocks_list::class);
|
||||
$this->addTplParam('sMainClass', d3tplblocks_main::class);
|
||||
return parent::render();
|
||||
}
|
||||
}
|
76
Application/Controller/Admin/TPLBlocks/d3tplblocks_base.php
Normal file
76
Application/Controller/Admin/TPLBlocks/d3tplblocks_base.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\TPLBlocks;
|
||||
|
||||
use D3\ModCfg\Application\Model\d3oxtplblocks;
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_main;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class d3tplblocks_base extends d3_cfg_mod_main
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
/** @var d3oxtplblocks $oTplBlock */
|
||||
$oTplBlock = oxNew(d3oxtplblocks::class);
|
||||
$this->addTplParam('edit', $oTplBlock);
|
||||
|
||||
if (method_exists($this, 'getEditObjectId')) {
|
||||
$soxId = $this->getEditObjectId();
|
||||
} else {
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
$this->addTplParam("oxid", $soxId);
|
||||
|
||||
// check if we right now saved a new entry
|
||||
if ($this->_sSavedId) {
|
||||
$soxId = $this->_sSavedId;
|
||||
$this->addTplParam("oxid", $soxId);
|
||||
|
||||
// for reloading upper frame
|
||||
$this->addTplParam("updatelist", "1");
|
||||
}
|
||||
}
|
||||
|
||||
if ($soxId && $soxId != "-1") {
|
||||
// load object
|
||||
if (!$oTplBlock instanceof d3oxtplblocks && !($oTplBlock->load($soxId))) {
|
||||
$soxId = '-1';
|
||||
$this->addTplParam('oxid', $soxId);
|
||||
} else {
|
||||
$oTplBlock->load($soxId);
|
||||
}
|
||||
}
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
}
|
218
Application/Controller/Admin/TPLBlocks/d3tplblocks_extend.php
Normal file
218
Application/Controller/Admin/TPLBlocks/d3tplblocks_extend.php
Normal file
@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\TPLBlocks;
|
||||
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\d3oxtplblocks;
|
||||
use D3\ModCfg\Application\Model\d3module;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\Module\Module;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\UtilsView;
|
||||
|
||||
class d3tplblocks_extend extends d3tplblocks_base
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/tplblocks/extend';
|
||||
protected $_aNonIndexedFields = ['oxartnum'];
|
||||
protected $_sSavedId = null;
|
||||
protected $_blUseOwnOxid = true;
|
||||
public $sSearchTerm;
|
||||
public $sAction;
|
||||
public $sSynsetId;
|
||||
public $aSynList;
|
||||
protected $_aNaviItems = [
|
||||
'new' => [
|
||||
'sScript' => 'top.basefrm.list.EditThis( -1 );return false;',
|
||||
'sTranslationId' => 'D3TPLBLOCKS_MAIN_NEWBLOCK',
|
||||
],
|
||||
];
|
||||
|
||||
protected $_sMenuItemTitle = 'mxextensions';
|
||||
|
||||
protected $_sMenuSubItemTitle = 'd3mxtplblocks';
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function hasTplBlocks()
|
||||
{
|
||||
$aBlockModules = $this->getTplBlockModules();
|
||||
|
||||
if ($aBlockModules && count($aBlockModules)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getTplBlockModules()
|
||||
{
|
||||
/** @var Module $oModule */
|
||||
$oModule = oxNew(Module::class);
|
||||
|
||||
/** @var d3module $oD3Module */
|
||||
$oD3Module = oxNew(d3module::class, $oModule);
|
||||
|
||||
return $oD3Module->d3GetTplBlockModules();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function clearTplBlocks()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if ($sModuleId = Registry::get(Request::class)->getRequestEscapedParameter('tplblockmodule')) {
|
||||
/** @var d3oxtplblocks $oTplBlocks */
|
||||
$oTplBlocks = oxNew(d3oxtplblocks::class);
|
||||
$oTplBlocks->clearTplBlocks($sModuleId);
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_REMBLOCKS_SUCC'));
|
||||
$this->addTplParam("updatelist", "1");
|
||||
} else {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_NOMODULEMSG'));
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function refreshTplBlocks()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if ($sModuleId = Registry::get(Request::class)->getRequestEscapedParameter('tplblockmodule')) {
|
||||
/** @var d3oxtplblocks $oTplBlocks */
|
||||
$oTplBlocks = oxNew(d3oxtplblocks::class);
|
||||
$oTplBlocks->refreshTplBlocks($sModuleId);
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_REFBLOCKS_SUCC'));
|
||||
$this->addTplParam("updatelist", "1");
|
||||
} else {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_NOMODULEMSG'));
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function deactivateTplBlocks()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if ($sModuleId = Registry::get(Request::class)->getRequestEscapedParameter('tplblockmodule')) {
|
||||
/** @var d3oxtplblocks $oTplBlocks */
|
||||
$oTplBlocks = oxNew(d3oxtplblocks::class);
|
||||
$oTplBlocks->deactivateTplBlocks($sModuleId);
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_DEACTBLOCKS_SUCC'));
|
||||
$this->addTplParam("updatelist", "1");
|
||||
} else {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_NOMODULEMSG'));
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function activateTplBlocks()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if ($sModuleId = Registry::get(Request::class)->getRequestEscapedParameter('tplblockmodule')) {
|
||||
/** @var d3oxtplblocks $oTplBlocks */
|
||||
$oTplBlocks = oxNew(d3oxtplblocks::class);
|
||||
$oTplBlocks->activateTplBlocks($sModuleId);
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_ACTBLOCKS_SUCC'));
|
||||
$this->addTplParam("updatelist", "1");
|
||||
} else {
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_NOMODULEMSG'));
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function clearDuplicates()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
/** @var d3oxtplblocks $oTplBlocks */
|
||||
$oTplBlocks = oxNew(d3oxtplblocks::class);
|
||||
$oTplBlocks->clearDuplicates();
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_CLEARDUPLICATES_SUCC'));
|
||||
$this->addTplParam("updatelist", "1");
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
}
|
85
Application/Controller/Admin/TPLBlocks/d3tplblocks_list.php
Normal file
85
Application/Controller/Admin/TPLBlocks/d3tplblocks_list.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\TPLBlocks;
|
||||
|
||||
use D3\ModCfg\Application\Controller\Admin\d3_cfg_mod_list;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\d3oxtplblocks;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Model\BaseModel;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3tplblocks_list extends d3_cfg_mod_list
|
||||
{
|
||||
protected $_blD3ShowLangSwitch = false;
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/tplblocks/list';
|
||||
protected $_sListClass = d3oxtplblocks::class;
|
||||
protected $_blEmployMultilanguage;
|
||||
protected $_sDefSortField = 'oxmodule';
|
||||
protected $_blShowListItems = true;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam("default_edit", "d3tplblocks_main");
|
||||
// assign our list
|
||||
//$this->addTplParam('mylist', $this->getItemList());
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BaseModel
|
||||
*/
|
||||
public function d3getListItemObject()
|
||||
{
|
||||
/** @var d3oxtplblocks $listObject */
|
||||
$listObject = parent::d3getListItemObject();
|
||||
|
||||
return $listObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aWhere
|
||||
* @param string $sqlFull
|
||||
* @return mixed|string
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
protected function prepareWhereQuery($aWhere, $sqlFull)
|
||||
{
|
||||
$aWhere = array_merge(
|
||||
$aWhere,
|
||||
[$this->d3getListItemObject()->getViewName(true).'.oxshopid' => Registry::getConfig()->getShopId()]
|
||||
);
|
||||
|
||||
$query = parent::prepareWhereQuery($aWhere, $sqlFull);
|
||||
|
||||
$sSearch = '';
|
||||
$oProfiles = $this->d3getListItemObject();
|
||||
$sSqlActiveSnippet = $oProfiles->getSqlActiveSnippet();
|
||||
|
||||
if ($sSqlActiveSnippet) {
|
||||
$sSearch .= " AND (".$sSqlActiveSnippet.") ";
|
||||
}
|
||||
|
||||
$query = str_replace($sSearch, '', $query);
|
||||
|
||||
return $query;
|
||||
}
|
||||
}
|
145
Application/Controller/Admin/TPLBlocks/d3tplblocks_main.php
Normal file
145
Application/Controller/Admin/TPLBlocks/d3tplblocks_main.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin\TPLBlocks;
|
||||
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\d3oxtplblocks;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseException;
|
||||
use OxidEsales\Eshop\Core\UtilsView;
|
||||
|
||||
class d3tplblocks_main extends d3tplblocks_base
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/tplblocks/main';
|
||||
protected $_aNonIndexedFields = ['oxartnum'];
|
||||
protected $_sSavedId = null;
|
||||
protected $_blUseOwnOxid = true;
|
||||
public $sSearchTerm;
|
||||
public $sAction;
|
||||
public $sSynsetId;
|
||||
public $aSynList;
|
||||
protected $_aNaviItems = [
|
||||
'new' => [
|
||||
'sScript' => 'top.basefrm.list.EditThis( -1 );return false;',
|
||||
'sTranslationId' => 'D3TPLBLOCKS_MAIN_NEWBLOCK',
|
||||
],
|
||||
];
|
||||
|
||||
protected $_sMenuItemTitle = 'mxextensions';
|
||||
|
||||
protected $_sMenuSubItemTitle = 'd3mxtplblocks';
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->sSearchTerm = Registry::get(Request::class)->getRequestEscapedParameter('searchterm');
|
||||
$this->sAction = Registry::get(Request::class)->getRequestEscapedParameter('action');
|
||||
$this->sSynsetId = Registry::get(Request::class)->getRequestEscapedParameter('synsetid');
|
||||
parent::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if (method_exists($this, 'getEditObjectId')) {
|
||||
$soxId = $this->getEditObjectId();
|
||||
} else {
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
}
|
||||
|
||||
$aParams = Registry::get(Request::class)->getRequestEscapedParameter("editval");
|
||||
|
||||
// default values
|
||||
$aParams = $this->addDefaultValues($aParams);
|
||||
|
||||
/** @var d3oxtplblocks $oTplBlock */
|
||||
$oTplBlock = oxNew(d3oxtplblocks::class);
|
||||
|
||||
if ($soxId != "-1") {
|
||||
$oTplBlock->load($soxId);
|
||||
} else {
|
||||
$aParams['oxtplblocks__oxid'] = null;
|
||||
}
|
||||
|
||||
$oTplBlock->assign($aParams);
|
||||
$oTplBlock->save();
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_MOVEFIRST_SUCC'));
|
||||
|
||||
if (method_exists($this, 'setEditObjectId')) {
|
||||
$this->setEditObjectId($oTplBlock->getId());
|
||||
} elseif ($soxId == "-1") {
|
||||
$this->_sSavedId = $oTplBlock->getId();
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseException
|
||||
* @throws DBALException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function moveToFirst()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if (method_exists($this, 'getEditObjectId')) {
|
||||
$soxId = $this->getEditObjectId();
|
||||
} else {
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
}
|
||||
|
||||
if ($soxId != "-1") {
|
||||
/** @var d3oxtplblocks $oTplBlock */
|
||||
$oTplBlock = oxNew(d3oxtplblocks::class);
|
||||
$oTplBlock->load($soxId);
|
||||
$oTplBlock->assign(
|
||||
[
|
||||
'oxpos' => $oTplBlock->getNextFirstPosition(),
|
||||
]
|
||||
);
|
||||
$oTplBlock->save();
|
||||
|
||||
if (method_exists($this, 'setEditObjectId')) {
|
||||
$this->setEditObjectId($oTplBlock->getId());
|
||||
}
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(new StandardException('D3TPLBLOCKS_MOVEFIRST_SUCC'));
|
||||
$this->addTplParam("updatelist", "1");
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
}
|
64
Application/Controller/Admin/d3_cfg_mod_.php
Normal file
64
Application/Controller/Admin/d3_cfg_mod_.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin;
|
||||
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminController;
|
||||
|
||||
class d3_cfg_mod_ extends AdminController
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/base_';
|
||||
protected $_sModId = '';
|
||||
protected $_hasListItems = false;
|
||||
protected $_sListItemFrameRelation = '40%,*';
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasListItems()
|
||||
{
|
||||
return $this->_hasListItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getModId()
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getAdditionalUrlParams()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getListItemFrameRelation()
|
||||
{
|
||||
return $this->_sListItemFrameRelation;
|
||||
}
|
||||
|
||||
public function getAdditionalHeadContent()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
617
Application/Controller/Admin/d3_cfg_mod_licence.php
Normal file
617
Application/Controller/Admin/d3_cfg_mod_licence.php
Normal file
@ -0,0 +1,617 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin;
|
||||
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use D3\ModCfg\Application\Model\Shopcompatibility\d3shopversionconverter;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Install\d3install;
|
||||
use D3\ModCfg\Application\Model\Installcheck\d3installcheck;
|
||||
use D3\ModCfg\Application\Model\d3utils;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\d3str;
|
||||
use D3\ModCfg\Application\Model\d3feeds;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseException;
|
||||
use stdClass;
|
||||
|
||||
class d3_cfg_mod_licence extends AdminDetailsController
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/base_license';
|
||||
protected $_sModId = Constants::OXID_MODULE_ID;
|
||||
protected $_hasLicence = false;
|
||||
protected $_hasUpdate = true;
|
||||
protected $_hasNewsletterForm = false;
|
||||
protected $_modUseCurl = false;
|
||||
protected $_sMenuItemTitle = 'd3mxcfg';
|
||||
protected $_sMenuSubItemTitle = 'd3tbcllib_support';
|
||||
protected $_sBlogFeed = "https://blog.oxidmodule.com/index.php?/feeds/index.rss2";
|
||||
protected $_sLogType = d3log::EMERGENCY;
|
||||
protected $_oInfoMail;
|
||||
public $mBlogContent;
|
||||
public $sHelpURL;
|
||||
public $oUpdateData;
|
||||
public $oNewestData;
|
||||
public $sAction;
|
||||
protected $_aMessages = [];
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_sDefaultHelpLinkAdd = 'Modul-Connector/';
|
||||
/**
|
||||
* additional multilang item, which will added as last part to help url
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_sHelpLinkMLAdd = 'D3MODCFG_LIB_HELPLINK_SUPPORT';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$sRet = parent::render();
|
||||
|
||||
$this->addTplParam('edit', $this->d3GetSet());
|
||||
$this->addTplParam('oxid', $this->d3GetSet()->getId());
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3_cfg_mod
|
||||
*/
|
||||
/**
|
||||
* @return d3_cfg_mod
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function d3GetSet()
|
||||
{
|
||||
return d3_cfg_mod::get($this->d3getModId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getModId()
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* ruft oxutils-Funktion auf, die vom Template aus nicht verfuegbar ist
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws StandardException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$this->d3GetSet()->prepareSaveData();
|
||||
$this->d3GetSet()->save();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getInstallClass()
|
||||
{
|
||||
if (class_exists(d3install::class)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function checkUpdate()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$oInstall = d3install::getInstance();
|
||||
$oUpdateServer = $oInstall->getFromUpdateServer();
|
||||
|
||||
$oModCfg = $this->d3GetSet();
|
||||
if ($oModCfg->getModCfgError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->d3GetSet()->getLicenseData('modversion')) {
|
||||
$oUpdateServer->setParameter('sLicModVersion', $this->d3GetSet()->getLicenseData('modversion'));
|
||||
}
|
||||
|
||||
/** @var d3shopversionconverter $oShopVersionConverter */
|
||||
$oShopVersionConverter = oxNew(d3shopversionconverter::class);
|
||||
$oUpdateServer->setParameter('sModId', $this->d3getModId());
|
||||
$oUpdateServer->setParameter(
|
||||
'sEdition',
|
||||
$oShopVersionConverter->fixEditionToDefaultEdition($this->getShopEdition())
|
||||
);
|
||||
$oUpdateServer->setParameter(
|
||||
'sShopVersion',
|
||||
$oShopVersionConverter->fixVersionToDefaultEdition($this->getShopVersion())
|
||||
);
|
||||
$aUpdateData = $oUpdateServer->getRemoteModuleVersion();
|
||||
|
||||
$this->sAction = 'versionCheck';
|
||||
|
||||
if (version_compare(
|
||||
$aUpdateData['availableversion']['version'],
|
||||
$oInstall->getInstalledModVersion($this->d3getModId()),
|
||||
'>'
|
||||
)) {
|
||||
$this->oUpdateData = $aUpdateData['availableversion'];
|
||||
}
|
||||
|
||||
if ($aUpdateData['newestversion'] &&
|
||||
is_array($aUpdateData['newestversion']) &&
|
||||
count($aUpdateData['newestversion'])
|
||||
) {
|
||||
$this->oNewestData = $aUpdateData['newestversion'];
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return $this->sAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sPart
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUpdateData($sPart)
|
||||
{
|
||||
return $this->oUpdateData[$sPart];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sPart
|
||||
* @return mixed
|
||||
*/
|
||||
public function getNewestModuleData($sPart)
|
||||
{
|
||||
return $this->oNewestData[$sPart];
|
||||
}
|
||||
|
||||
/**
|
||||
* request newsletter form
|
||||
*/
|
||||
public function setInfoMail()
|
||||
{
|
||||
$this->_oInfoMail = new stdClass();
|
||||
$oInfoMailXML = false;
|
||||
$iError = false;
|
||||
|
||||
// $aParams = oxConfig::getParameter("service");
|
||||
|
||||
// $sEMail = trim($aParams['d3_cfg_mod__s_updateinfomail']);
|
||||
// $blActive = (bool)$aParams['d3_cfg_mod__bl_updateinfo'];
|
||||
/*
|
||||
if (strlen($sEMail) && !d3_oxUtils_cfg::getInstance()->D3checkEmail($sEMail))
|
||||
{
|
||||
$this->_oInfoMail->iError = 1;
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
//d3_oxUtils_cfg::getInstance()->setModInfoMail($this->soxId, $oInfoMailXML, $iError, $sEMail, $blActive);
|
||||
|
||||
$this->_oInfoMail->iError = $iError;
|
||||
|
||||
$this->_oInfoMail->oXML = $oInfoMailXML;
|
||||
//if ($iError) return;
|
||||
|
||||
// is removed
|
||||
// d3_oxUtils_cfg::getInstance()->SaveModCfg($this->soxId);
|
||||
//$this->d3GetSet()->d3_cfg_mod__importer_supdateinfomail = new oxField($sEMail, oxField::T_RAW);
|
||||
//$this->d3GetSet()->d3_cfg_mod__importer_blupdateinfo = new oxField($blActive, oxField::T_RAW);
|
||||
//$this->d3GetSet()->Save();
|
||||
//dumpvar($_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* schreibt Lizenzkey in Modulconfig
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function submit_licensekey()
|
||||
{
|
||||
if (false == $this->hasDemoShopMode()) {
|
||||
$this->d3GetSet()->setSerial(Registry::get(Request::class)->getRequestEscapedParameter('licensekey'));
|
||||
$this->d3GetSet()->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDemoShopMode()
|
||||
{
|
||||
return d3utils::getInstance()->hasDemoShopMode();
|
||||
}
|
||||
|
||||
public function image_logo()
|
||||
{
|
||||
$img_data =
|
||||
"R0lGODlhRgBHAPf/AAB+5M3i9gCS+ACN9LPb+hp61oK567jh/ZvV/UKS3gB43vP5/tLr/QB02gCC6ACA5gCG7QCI7qPV+qjP8rza9crh9gB84sLe90eq9LHV9QBs2Emj7QCF8QB23ACL8gB64ACK8DOX6XW68iid9HTE/Hy67gCR/eX0/nvF+gCQ9mzB/Mvl+gCW/4rG9T2k8sLk/BGd/lK2/Pr9/yaK4pPO+lml5yKl/i6F2TaL3ABq0IvL+uDy/gCQ+G+z7Tyt+wB65ACK9gCB7ez1/QyV+J3N9QB+6a/a+gCN+AyT9QBmz0SV4dzx/gBy3avR84XD9AuM7mC6+lmy9COT6xKK6QCU/qXK7g6Z+Uaa5Tat/gB24cXg97jW8y2q/jKh9FWs8cje9VSc4RuE33nI/mK39gea/6vX+Wq/+wB44QBp1ACA6gBy21Cl7Fq7/JLG8m2q5QCU/Kra/Oby+2W59xOT8huT7gCJ7wBo0ABm0Ryc9/3+/wCE7r7f+k21/F2p6QB446/f/z6w/QCG7+Ty/AB+5g2e/wBo0gB75LfZ98Lf+DKm+ABr0gCC6wCA6ACT+tjs+xie+gBv1wB23oLJ+wqd/wWS9wCK8wB12wBw2Q593gCI8hSG5G6t6VCw9wB64gBz3gBv3AOY/wB75wBw1gCU+gBv1QBy2ABs0gBx1wBz2QBu1ABt0wCV+wCX/QCW/ACF6wCZ/wCE6gCY/gBy2QBz2ABt1ABw1wCE6wCW+wBx1gCF6gCY/wCW/QCY/QBr0QCU+wBu1QBv1AB22wBu0wBs0wCV+gCX/ABt0gCK7wBw1Q+Y+ACD6QB02QCG6wGZ/wCT+XCr5QBy1wR84RyO6QVt0WWl4y2P5AOW+xWi/1e6/QSN9Vi2+gSU+XzA9gOC6BOZ9xyX8qbS9QBs1gCR+2m28m+58s/s/zSd7wyc/wOM8gaN8gOI7QaU9+74/hiJ5waI7A2G5yin/lWj5lim6QV53WCu7geB5ff7/j+p9qzY+ajc/4vB8ACZ/n/G+kKe6////87i9iH5BAEAAP8ALAAAAABGAEcAAAj/AP8JHEiwoMGDCBMirHBIUgxAXLDwUWGkgsKLGAMgKiNBhxk+gADxMaNDQhlEARAGoMEFFIuXunTBBIQIo02CiCSowDKp2UsWsV69kvmy2SQsKiTUHFghxkuhUKOysJHypsIKEmIQokKFBatYYMPG2hdLF1hWLLgSiiGhQgUfVKLqigqVCgqrCC9IssH1q9i/gMWy4goPAZeuQ1mQmUSGhVR4FvEy5Qej61demFlpxsxL8+VYnkF3jkUFiz8ZCPiC0oHoAiJsjoXqgkFB8r8AEvju8sy7t+/fmk0g8EfcnhgaBI3EfsWCS2SrWrBx3V1M867qrHZr382qGPfqrbBn/2/FRgwJEmLEmNEyUMJyKiQkG3lkopX9+/jz69+P34T//yZYgc8/BNgwF3NksGeVDo28scotqzz4YCsS3gKhfRauQmGEE2ZoX4QZariKLyoc8AcMsbEACgFWBcCPOL5wKOOMNNZoI42+WMMAcfmcw4Iu17B4UwAq8DDKkUiO4osvoxBDjJJJRinlkU8i+aQvTzbyCDvE+fOHj5OQUNVFAZBwRCNTRokmkmum6WaSPPjQJXF/NCacTToc4cyefPbp55+ABirAoIQ6I8Aj2phxQJcIvITFmAiVccSgfApg6J6WGpoppZlqyumfAgyRTDJWlLqNoUcAwcMLXZJggg3PHf+kxRA8EGrroDykwMOuvPba66238vAIAyfsYOwJPkw6KBDDEScDIFQlFAAGygIrACWjZqvttqOuI0CqQByRAqFHJDIncTEAMegRQywxZzkqKEQDECnUa6+9QECxwAn89uvvv0swcAACZiRCCRADCDCAuececDAQ3sBxrj97JKQFEgPcqzEQNEzs8cd5OCIJHgjjweW5jkgAxwkT7zCCggbJQa/G9w7A6sc4T7wACtlkQkDOE2vDgRwHHTLA0UgnncIASOwA9NNdHpBNF/ZAnYcZlRx9iEFjZJ3015WMIAPUZB+QCSdV58zAPZkcXckYBVWAztd0n0323fwEMYIEQkz/fIIRnKTTNtLoxNoCBx4krvjiHnDAzd1kLzACB5nM4UIUcozBSRdIZII44xy0MFAAI4DA+OmBSJBzHjK0DrkOiIPgOQe0Z2L66R6AMEJVhwQCwu/ABw9CHXWskLME34wwwuU0sAw0A+jUIfz00wey9T9O6BE88SAcQ3wdgczRN85jBBHI+XoEMQc+QMswgu/df1/HMd5L3/3vdejhxG0u6CH//8TTQxeA1r8IyE8PT3AE0DDgPwA68HuBcEEALvCECFjwghi0YBCikDN20EEPGYxAEB6XsygEIYQozOATtJCBRUDghTCM4QuD4AS1qUOGM9wA0EyIwx7KcBEZaIEL/30Iw0X8DGf4SEMPF2GOBSqRiD5cRAtEkAZXWPGKWHSFLdyxI5xxowhYZIYV0+ACAlYxi1kUYxbTIAIvpAEWttAiLHKRC1fU0RZpoMMCcuaFIuQCFnacoy2K4IWc2UMKabDFHLVoR1s40hZ0VCQcbeEAL5hjEbBQBiw2yUlOFqGMOMtDCIrQSU+SI2eCmMIbS8lKVjrAHFJwgDJmSctaKiMU40DlFGRpy1sSIWd7YEQvh9lLB0hhlw5IpjKX6YBQ/BJnL3gAM5XZDePhzAmhmKY2tTkFZG7TAQ8YxB5yRoRsTjMUIchDzjZgzm9+cwrSeIA850nPcL5DEDkjhx/qKf9PP9QQZ6kcBD8HOlBphAAACE2oQgFgCCmMDWcb+AFCH5BQQ7QDnzgjgkQBQNGFetSjIdiAIT6aUD+swZBSGOlCs9AGoPXDDySNaUU30AOYxjQLJciZI+qhUoRaIAv0ABoiLCDTovqhBwboxEeJ+lNw5OwQZ7CAVDuRhU704KE4W0MWFkrUoia0EwZoQhakStayStWaH3PCJ7Jwhg9oYg2IeFoGomrWutqVrFloAgWi8YG7nkET4/vYCojQhEOsILA5E8IMxnrXxpL1A9GgQACqoYAPWPaylo1ECCBHtj4wAbOgDa1oFVCNlPTAEwqobGUvy4Q+cPZpJUDtZVf7AdX/Wpa2qlWtJ3ogkCagNrXATe0n9PHanJWACcFNrnKXm1pPNEEgXwhDJJbriQwU12NCkAdymctd5UYiDF8YSA+2G9wOzEOB1+2SDIgQhk90973BZQJvB0IBNXTgvvhVQxj2mF5BtKEal7AvfgdM4AIbWA21Gd0V1BCMYFjCwZe4wmtlEIcL6OMKmNDAJSzB4Q48mMMOtoSHQ8zhDjvYwx5WwxUg9Y8JbLjEllDDDPpQgxrb+MY4jscVZoAJNWgAEqiAsZCHTGQiX2ICBgmAEi7RgCY3+RIaiLKUp0xlKV9CFqhwspa3zOUuc/kSSmCxQLYACSyj4sxoTrOa07yMBqwZ/xXLePOZ4yznN8sCEltIyCY0MItSzAIVspiFLErhZ0H3+c+oELQssEzoRf+50IvG8iwmvWhAlyLQhIY0Kgg96XBs4iphgESmR03qUpMaGqZOtapLDYkwxOogGUBDLU5B61rb+ta0hgaud83rXtu6FuHIgE0MIGtciEIUp6hFLY6d7GOLwtinMLYolL3sZSfb2Ms2Ni6wfextbzvatYD2KUSBBgMMCQxocLa6183udrv73e5GAxjELK0EoIEU+CYFMiCR73wjw9/97je/Ay5wfA884MhAQwLofRUcFAIY+E4FMFLxC4hTnBQQJ8UvAg6MX2ycFBfneL5TofF8Q7wQOP949U2+oIRCpOLlMI+5zGdO85rXvBBKCK9tBBIAMNxBFamghSpUQQthED0VwqAFLZA+9KQLPelIV7rQh670lxNd6EpXxR3mvXOCBMAAhVDE0MdO9rKb/exoH7siCmEAhttmAgVIgthNQXdTDIPuw7j7MIxhDFP03e91r7sq6p53uvf9DgVActcR8gU35MAOgY+85CdPebrbIQdu0PniE7KFBNjBDr2gey8UYYpemF4Roy+9KUgfeNKHPvSK+HwC8rz5jFQhATlIQg5Mz/ve+/73ps99DhJQBbfXPslbcEPck3D53u/+9zmIvh2SkIQCuGELxj9+Qr5QhWfcYBrUp/4r5aP/+PAnYRo3eEYVNK/9xVeAAlUwADXAgIMC2L8AOAADNQxQBQqovOsBAQA7";
|
||||
header("Content-type: image/gif");
|
||||
echo base64_decode($img_data);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLogoUrl()
|
||||
{
|
||||
$aParams = [
|
||||
'cl' => $this->getClassKey(),
|
||||
'fnc' => 'image_logo',
|
||||
];
|
||||
$sURL = Registry::get(d3utils::class)->getAdminClassUrl($aParams);
|
||||
|
||||
return $sURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasLicense()
|
||||
{
|
||||
return $this->_hasLicence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function hasLicenseKey()
|
||||
{
|
||||
if ($this->d3GetSet()->getFieldData('oxserial')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function hasUpdate()
|
||||
{
|
||||
if (class_exists(d3install::class)) {
|
||||
$oModCfg = $this->d3GetSet();
|
||||
if ($oModCfg->getModCfgError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasNewsletterForm()
|
||||
{
|
||||
return $this->_hasNewsletterForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function checkModuleVersion()
|
||||
{
|
||||
if (ip2long($this->d3GetSet()->getFieldData('oxversion')) == $this->d3GetSet()->getFieldData('oxversionnum')) {
|
||||
return 'OK';
|
||||
}
|
||||
|
||||
return 'NOK';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function d3CheckCurl()
|
||||
{
|
||||
if (false == function_exists('curl_init')) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function d3ModUseCurl()
|
||||
{
|
||||
return $this->_modUseCurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sShopVersion
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function check4ShopUpdate($sShopVersion)
|
||||
{
|
||||
/** @var d3shopversionconverter $oShopVersionConverter */
|
||||
$oShopVersionConverter = oxNew(d3shopversionconverter::class);
|
||||
return version_compare(
|
||||
$oShopVersionConverter->fixVersionToDefaultEdition($this->getShopVersion()),
|
||||
$sShopVersion,
|
||||
"<"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
* @param $sModVersion
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function check4LicenseUpdate($sModId, $sModVersion)
|
||||
{
|
||||
/** @var d3str $oStr */
|
||||
$oStr = oxNew(d3str::class);
|
||||
if ($this->d3GetSet()->getLicenseData('modversion')) {
|
||||
if ($oStr->versionToInt($sModVersion, 999) >
|
||||
$oStr->versionToInt(d3_cfg_mod::get($sModId)->getLicenseData('modversion'), 999)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetMenuItemTitle()
|
||||
{
|
||||
return $this->_sMenuItemTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetMenuSubItemTitle()
|
||||
{
|
||||
return $this->_sMenuSubItemTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getHelpURL()
|
||||
{
|
||||
if ($this->sHelpURL === null) {
|
||||
$this->sHelpURL = false;
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$sUrl = $this->d3GetSet()->getHelpURL();
|
||||
/** @var d3filesystem $oFS */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
|
||||
if (false == $this->d3GetSet()->getHelpUrlAdd()) {
|
||||
$sUrl .= $oFS->unprefixedslashit($this->_sDefaultHelpLinkAdd);
|
||||
}
|
||||
|
||||
if ($this->_sHelpLinkMLAdd) {
|
||||
$sUrl .= $oFS->unprefixedslashit(Registry::getLang()->TranslateString($this->_sHelpLinkMLAdd));
|
||||
}
|
||||
|
||||
$aFileName = $oFS->splitFilename($sUrl);
|
||||
|
||||
// has no extension
|
||||
if (false == $aFileName['ext']) {
|
||||
$sUrl = $oFS->trailingslashit($sUrl);
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$this->sHelpURL = $sUrl;
|
||||
}
|
||||
|
||||
return $this->sHelpURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|mixed
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws DatabaseException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function hasBlogContent()
|
||||
{
|
||||
if ($this->mBlogContent === null) {
|
||||
$this->mBlogContent = false;
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$oModCfgSet = d3_cfg_mod::get('d3modcfg_lib');
|
||||
if (! $oModCfgSet->getValue('blModCfg_noSupportBlogInfo') ||
|
||||
! $this->d3GetSet()->getValue('blModCfg_noSupportBlogInfo')
|
||||
) {
|
||||
/** @var d3feeds $oFeed */
|
||||
$oFeed = oxNew(d3feeds::class);
|
||||
$this->mBlogContent = $oFeed->getAdminSupportContent($this->_sBlogFeed);
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->mBlogContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlogBaseUrl()
|
||||
{
|
||||
/** @var d3feeds $oFeed */
|
||||
$oFeed = oxNew(d3feeds::class);
|
||||
return $oFeed->getBlogBaseUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function getExpireSpanString()
|
||||
{
|
||||
if ($this->d3GetSet()->isExpired()) {
|
||||
return Registry::getLang()->translateString('D3_CFG_MOD_STATUS_EXPIRED');
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
Registry::getLang()->translateString("D3_CFG_MOD_STATUS_EXPIRES_IN"),
|
||||
$this->d3GetSet()->getExpireTimeSpan()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUserMessages()
|
||||
{
|
||||
return $this->_aMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLicenceFrameUrl($sModId)
|
||||
{
|
||||
$aParams = [
|
||||
'cl' => 'd3mod_activation', # don't use d3mod_activation::class
|
||||
'modid' => $sModId,
|
||||
'bgcolor' => '#F0F0F0',
|
||||
];
|
||||
return Registry::get(d3utils::class)->getAdminClassUrl($aParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3installcheck
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getInstallCheck()
|
||||
{
|
||||
$oInstallCheck = oxNew(d3installcheck::class, $this->d3GetSet());
|
||||
|
||||
return $oInstallCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
}
|
368
Application/Controller/Admin/d3_cfg_mod_list.php
Normal file
368
Application/Controller/Admin/d3_cfg_mod_list.php
Normal file
@ -0,0 +1,368 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3modprofile;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver\Exception;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use DOMAttr;
|
||||
use DOMElement;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminListController;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Model\ListModel;
|
||||
use OxidEsales\Eshop\Core\StrMb;
|
||||
use OxidEsales\Eshop\Core\TableViewNameGenerator;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Eshop\Core\StrRegular;
|
||||
use OxidEsales\Eshop\Core\Str;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProviderInterface;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3_cfg_mod_list extends AdminListController
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/base_list';
|
||||
protected $_sModId = '';
|
||||
protected $_sMenuItemTitle = 'd3mxcfg';
|
||||
protected $_sMenuSubItemTitle = 'd3mxlibs';
|
||||
protected $_blUpdateMain = null;
|
||||
// enable language depended configuration
|
||||
protected $_blD3ShowLangSwitch = true;
|
||||
protected $_blShowListItems = false;
|
||||
protected $_sListClass = d3modprofile::class;
|
||||
protected $_sDefSortField = 'oxsort';
|
||||
protected $_blDesc = false;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->addTplParam('actlocation', false);
|
||||
$this->addTplParam('Errors', false);
|
||||
$this->addTplParam('box', 'box');
|
||||
$this->addTplParam('readonly', false);
|
||||
$this->addTplParam('shop', Registry::getConfig()->getActiveShop());
|
||||
$this->addTplParam('art_category', null);
|
||||
$this->addTplParam('_act', null);
|
||||
$this->addTplParam('readonly', false);
|
||||
$this->addTplParam('lstrt', false);
|
||||
$this->addTplParam('updatenav', false);
|
||||
$this->addTplParam('delshopid', false);
|
||||
$this->addTplParam('issubvariant', false);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
if ($this->_sListClass) {
|
||||
/** @var d3modprofile $oListObject */
|
||||
$oListObject = oxNew($this->_sListClass);
|
||||
if (method_exists($oListObject, 'd3IsMultilang')) {
|
||||
$this->_blD3ShowLangSwitch = $oListObject->d3IsMultilang();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$sRet = parent::render();
|
||||
|
||||
// default page number 1
|
||||
$this->addTplParam('oxid', Registry::get(Request::class)->getRequestEscapedParameter('oxid'));
|
||||
if (false == $this->getViewDataElement('oxid')) {
|
||||
$this->addTplParam('oxid', 1);
|
||||
}
|
||||
|
||||
if ($this->getViewDataElement('oxid') == -1 &&
|
||||
(
|
||||
false == $this->_sListClass or (
|
||||
$this->_sListClass == d3modprofile::class &&
|
||||
false == $this->d3getModId()
|
||||
)
|
||||
)
|
||||
) {
|
||||
// wenn kein Eintrag gewaehlt und keine Liste gezeigt wird
|
||||
$this->addTplParam('oxid', 1);
|
||||
}
|
||||
|
||||
// disabled because of errors while delete list items
|
||||
//$this->addTplParam('default_edit', d3_cfg_mod_main::class);
|
||||
$this->addTplParam('updatemain', $this->_blUpdateMain);
|
||||
$this->addTplParam('blShowLangSwitch', $this->_blD3ShowLangSwitch);
|
||||
|
||||
/*
|
||||
if (Registry::get(Request::class)->getRequestEscapedParameter('listitems') && $this->getViewDataElement('where')) {
|
||||
$aWhere = $this->getViewDataElement('where');
|
||||
}
|
||||
*/
|
||||
|
||||
if ($this->d3getShowListItems()) {
|
||||
$sFolder = Registry::get(Request::class)->getRequestEscapedParameter("folder");
|
||||
$sFolder = $sFolder ?: -1;
|
||||
$this->addTplParam("folder", $sFolder);
|
||||
}
|
||||
|
||||
$this->d3FixNamespaceNavigation();
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* escape namespace slashes for javascript use
|
||||
*/
|
||||
public function d3FixNamespaceNavigation()
|
||||
{
|
||||
/** @var DOMElement $oNavi */
|
||||
foreach ($this->getViewDataElement('editnavi') as $oNavi) {
|
||||
/** @var DOMAttr $oAttribute */
|
||||
foreach ($oNavi->attributes as $oAttribute) {
|
||||
if (strtolower($oAttribute->name) == 'cl'
|
||||
&& strstr($oAttribute->nodeValue, '\\')
|
||||
&& !str_contains($oAttribute->nodeValue, '\\\\')
|
||||
) {
|
||||
$oAttribute->nodeValue = addslashes($oAttribute->nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aWhere
|
||||
* @param string $sqlFull
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function prepareWhereQuery($aWhere, $sqlFull)
|
||||
{
|
||||
/** @var Connection $db */
|
||||
$db = ContainerFactory::getInstance()->getContainer()->get(ConnectionProviderInterface::class)->get();
|
||||
$sQ = parent::prepareWhereQuery($aWhere, $sqlFull);
|
||||
|
||||
$oProfiles = $this->d3getListItemObject();
|
||||
|
||||
if ($this->_sListClass != d3modprofile::class) {
|
||||
$sSqlActiveSnippet = $oProfiles->getSqlActiveSnippet();
|
||||
if ($sSqlActiveSnippet) {
|
||||
$sQ .= " AND (".$sSqlActiveSnippet.") ";
|
||||
}
|
||||
}
|
||||
|
||||
$sFolder = Registry::get(Request::class)->getRequestEscapedParameter('folder');
|
||||
//searchong for empty oxfolder fields
|
||||
if ($sFolder && $sFolder != '-1') {
|
||||
$sQ .= " and ( ".$oProfiles->getViewName().".oxfolder = ".$db->quote($sFolder)." ) ";
|
||||
}
|
||||
|
||||
return $sQ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates list items count
|
||||
*
|
||||
* @param string $sSql SQL query used co select list items
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws Exception
|
||||
* @throws DBALException
|
||||
*/
|
||||
protected function _calcListItemsCount($sSql)
|
||||
{
|
||||
/** @var StrMb|StrRegular $oStr */
|
||||
$oStr = Str::getStr();
|
||||
|
||||
// count SQL
|
||||
$oQB = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
|
||||
/** @var Connection $db */
|
||||
$db = ContainerFactory::getInstance()->getContainer()->get(ConnectionProviderInterface::class)->get();
|
||||
$oQB->select('count(*)')->from('');
|
||||
|
||||
$sSql = $oStr->preg_replace('/select .*? from/i', $oQB->getSQL(), $sSql);
|
||||
|
||||
// removing order by
|
||||
$sSql = $oStr->preg_replace('/order by .*$/i', '', $sSql);
|
||||
|
||||
$sSql .= ' LIMIT 1';
|
||||
|
||||
// con of list items which fits current search conditions
|
||||
$this->_iListSize = (int) $db->prepare($sSql)->executeQuery()->fetchOne();
|
||||
|
||||
// set it into session that other frames know about size of DB
|
||||
Registry::getSession()->setVariable('iArtCnt', $this->_iListSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function d3getAdditionalFormParams()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetMenuItemTitle()
|
||||
{
|
||||
return $this->_sMenuItemTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetMenuSubItemTitle()
|
||||
{
|
||||
return $this->_sMenuSubItemTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getModId()
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function d3getShowListItems()
|
||||
{
|
||||
return $this->_blShowListItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getListItemClass()
|
||||
{
|
||||
return $this->_sListClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3modprofile
|
||||
*/
|
||||
public function d3getListItemObject()
|
||||
{
|
||||
$oObject = oxNew($this->d3getListItemClass());
|
||||
return $oObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getSelectableFolderList()
|
||||
{
|
||||
$oProfile = $this->d3getListItemObject();
|
||||
return $oProfile->d3getSelectableFolderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsOrderStep()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLink()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $sSql
|
||||
* bugfix for OXID error (EE521):
|
||||
* @return null|string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function _prepareOrderByQuery($sSql = null)
|
||||
{
|
||||
// sorting
|
||||
$aSortFields = $this->getListSorting();
|
||||
/** @var Connection $db */
|
||||
$db = ContainerFactory::getInstance()->getContainer()->get(ConnectionProviderInterface::class)->get();
|
||||
|
||||
if (is_array($aSortFields) && count($aSortFields)) {
|
||||
// only add order by at full sql not for count(*)
|
||||
$sSql .= ' order by ';
|
||||
$blSep = false;
|
||||
|
||||
$oListItem = $this->getItemListBaseObject();
|
||||
$iLangId = $oListItem->isMultilang() ? $oListItem->getLanguage() : Registry::getLang()->getBaseLanguage();
|
||||
|
||||
$descending = Registry::get(Request::class)->getRequestEscapedParameter('adminorder');
|
||||
$descending = $descending !== null ? (bool)$descending : $this->_blDesc;
|
||||
|
||||
foreach ($aSortFields as $sTable => $aFieldData) {
|
||||
if ($sTable && isset($this->_sListClass) && class_exists($this->_sListClass)) {
|
||||
$oListObject = oxNew($this->_sListClass);
|
||||
$sTable = $oListObject->getViewName() . '.';
|
||||
} else {
|
||||
/** @var TableViewNameGenerator $oViewNameGenerator */
|
||||
$oViewNameGenerator = oxNew(TableViewNameGenerator::class);
|
||||
$sTable = $sTable ? ($oViewNameGenerator->getViewName($sTable, $iLangId) . '.') : '';
|
||||
}
|
||||
|
||||
foreach ($aFieldData as $sColumn => $sSortDir) {
|
||||
$sField = $sTable . $sColumn;
|
||||
//add table name to column name if no table name found attached to column name
|
||||
$sSql .= ((($blSep) ? ', ' : '')) . $db->quoteIdentifier($sField);
|
||||
|
||||
//V oxActive field search always DESC
|
||||
$this->addTplParam("nextSortDir", "desc");
|
||||
if ($descending || $sColumn == "oxactive" || strcasecmp($sSortDir, 'desc') == 0) {
|
||||
$sSql .= ' desc ';
|
||||
$this->addTplParam("nextSortDir", "asc");
|
||||
}
|
||||
|
||||
$blSep = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sSql;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ListModel
|
||||
*/
|
||||
public function getItemList()
|
||||
{
|
||||
if (false == $this->_blShowListItems) {
|
||||
$oList = oxNew($this->_sListType);
|
||||
return $oList;
|
||||
}
|
||||
|
||||
return parent::getItemList();
|
||||
}
|
||||
}
|
605
Application/Controller/Admin/d3_cfg_mod_main.php
Normal file
605
Application/Controller/Admin/d3_cfg_mod_main.php
Normal file
@ -0,0 +1,605 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Controller\Admin;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3modprofile;
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Installcheck\d3installcheck;
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Request;
|
||||
use OxidEsales\Facts\Config\ConfigFile;
|
||||
use stdClass;
|
||||
|
||||
class d3_cfg_mod_main extends AdminDetailsController
|
||||
{
|
||||
protected $_sThisTemplate = '@'.Constants::OXID_MODULE_ID.'/admin/base_main';
|
||||
protected $_sModId = 'd3modcfg_lib';
|
||||
protected $_sMenuItemTitle = 'd3mxcfg';
|
||||
protected $_sMenuSubItemTitle = 'd3mxlibs';
|
||||
protected $_aMessages;
|
||||
protected $_blUseOwnOxid = false; // edit ModCfg -> false; edit profile -> true
|
||||
public $soxId = null;
|
||||
protected $_blUseModCfgStdObject = false;
|
||||
/** @var string additional multilang item, which will added as last part to help url */
|
||||
protected $_sHelpLinkMLAdd;
|
||||
protected $_blHasDebugSwitch = false;
|
||||
protected $_blHasTestModeSwitch = false;
|
||||
protected $_sDebugHelpTextIdent = 'D3_CFG_MOD_GENERAL_DEBUGACTIVE_DESC';
|
||||
protected $_sTestModeHelpTextIdent = 'D3_CFG_MOD_GENERAL_TESTMODEACTIVE_DESC';
|
||||
protected $_sSavedId;
|
||||
protected $_aNaviItems = [];
|
||||
protected $_sD3ObjectClass = d3modprofile::class;
|
||||
protected $_sSetModId;
|
||||
protected $_blD3ShowLangSwitch = true;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$this->addTplParam('aLanguages', Registry::getLang()->getLanguageArray());
|
||||
$this->addTplParam('actlocation', false);
|
||||
$this->addTplParam('Errors', false);
|
||||
$this->addTplParam('box', 'box');
|
||||
$this->addTplParam('shop', Registry::getConfig()->getActiveShop());
|
||||
$this->addTplParam('art_category', null);
|
||||
$this->addTplParam('_act', null);
|
||||
$this->addTplParam('readonly', false);
|
||||
$this->addTplParam('lstrt', false);
|
||||
$this->addTplParam('updatenav', false);
|
||||
$this->addTplParam('issubvariant', false);
|
||||
|
||||
parent::__construct();
|
||||
|
||||
/** @var d3modprofile $oListObject */
|
||||
$oListObject = oxNew($this->_sD3ObjectClass);
|
||||
if (method_exists($oListObject, 'd3IsMultilang')) {
|
||||
$this->_blD3ShowLangSwitch = $oListObject->d3IsMultilang();
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|d3_cfg_mod
|
||||
*/
|
||||
/**
|
||||
* @return bool|d3_cfg_mod
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function d3GetSet()
|
||||
{
|
||||
if (d3_cfg_mod::isCallable()) {
|
||||
if ($this->_blUseModCfgStdObject) {
|
||||
return d3_cfg_mod::get($this->d3getModId());
|
||||
} else {
|
||||
return d3_cfg_mod::get($this->d3getModId());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3log
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function d3getLog()
|
||||
{
|
||||
return $this->d3GetSet()->d3getLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getValueStatus()
|
||||
{
|
||||
if (false == $this->d3GetSet()->getFieldData('oxvalue') ||
|
||||
strlen($this->d3GetSet()->getFieldData('oxvalue')) == 0
|
||||
) {
|
||||
return 'error';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
$sRet = parent::render();
|
||||
|
||||
$soxId = $this->getEditObjectId();
|
||||
|
||||
if (false == $this->d3GetSet()->getFieldData('oxvalue') && d3log::isCallable()) {
|
||||
$this->d3getLog()->log(
|
||||
d3log::INFO,
|
||||
self::class,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
"Admin-Error",
|
||||
"no oValue-Var: " . $this->d3GetSet()->getFieldData('oxmodid')
|
||||
);
|
||||
}
|
||||
|
||||
$this->addTplParam('blShowLangSwitch', $this->_blD3ShowLangSwitch);
|
||||
|
||||
if (false == $this->_blUseOwnOxid) {
|
||||
$this->addTplParam('oxid', $this->d3GetSet()->getId());
|
||||
$this->addTplParam('edit', $this->d3GetSet());
|
||||
// ToDo: required??
|
||||
$this->addTplParam('value', $this->d3GetSet()->getAllValues());
|
||||
} else {
|
||||
$oProfile = $this->getProfile();
|
||||
$this->addTplParam('edit', $oProfile);
|
||||
$this->addTplParam('oSet', $oProfile->d3getModCfg());
|
||||
|
||||
// check if we right now saved a new entry
|
||||
if ($this->_sSavedId) {
|
||||
$soxId = $this->_sSavedId;
|
||||
$this->addTplParam("oxid", $soxId);
|
||||
|
||||
// for reloading upper frame
|
||||
$this->addTplParam("updatelist", "1");
|
||||
}
|
||||
|
||||
if ($soxId && $soxId != "-1") {
|
||||
$oOtherLang = $oProfile->getAvailableInLangs();
|
||||
$aLang = array_diff(Registry::getLang()->getLanguageNames(), $oOtherLang);
|
||||
if (count($aLang)) {
|
||||
$this->addTplParam("posslang", $aLang);
|
||||
}
|
||||
|
||||
foreach ($oOtherLang as $id => $language) {
|
||||
$oLang = new stdClass();
|
||||
$oLang->sLangDesc = $language;
|
||||
$oLang->selected = ($id == $this->_iEditLang);
|
||||
$this->_aViewData["otherlang"][$id] = clone $oLang;
|
||||
}
|
||||
}
|
||||
|
||||
if ($oProfile->isWriteProtected()) {
|
||||
$this->addTplParam('readonly', true);
|
||||
}
|
||||
}
|
||||
|
||||
$this->fakeBottomMenu();
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3modprofile|null
|
||||
*/
|
||||
public function getProfile()
|
||||
{
|
||||
$oProfile = null;
|
||||
|
||||
if ($this->_blUseOwnOxid) {
|
||||
/** @var d3modprofile $oProfile */
|
||||
$oProfile = oxNew($this->_sD3ObjectClass);
|
||||
|
||||
$soxId = $this->getEditObjectId();
|
||||
|
||||
if ($soxId && $soxId != "-1") {
|
||||
// load object
|
||||
$oProfile->loadInLang($this->_iEditLang, $soxId);
|
||||
|
||||
// load object in other languages
|
||||
$oOtherLang = $oProfile->getAvailableInLangs();
|
||||
if (false == isset($oOtherLang[$this->_iEditLang])) {
|
||||
$oProfile->loadInLang(key($oOtherLang), $soxId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $oProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
* @throws Exception
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
|
||||
if (false == $this->_blUseOwnOxid) {
|
||||
$this->d3GetSet()->setLanguage($this->_iEditLang);
|
||||
$this->d3GetSet()->prepareSaveData();
|
||||
$this->d3GetSet()->save();
|
||||
/** @var d3installcheck $oInstallCheck */
|
||||
$oInstallCheck = oxNew(d3installcheck::class, $this->d3GetSet());
|
||||
|
||||
if ($this->d3GetSet()->getFieldData('oxactive') &&
|
||||
$this->isAdmin() &&
|
||||
$oInstallCheck->hasErrors()
|
||||
) {
|
||||
$this->_aMessages[] = Registry::getLang()->translateString('D3_CFG_MOD_INSTALLCHECK_PROBLEM');
|
||||
}
|
||||
} else {
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
$aParams = (array) Registry::get(Request::class)->getRequestEscapedParameter("editval");
|
||||
|
||||
// default values
|
||||
$aParams = $this->addDefaultValues($aParams);
|
||||
|
||||
/** @var d3modprofile $oProfile */
|
||||
$oProfile = oxNew($this->_sD3ObjectClass);
|
||||
|
||||
$oProfile->setLanguage($this->_iEditLang);
|
||||
if ($soxId != "-1") {
|
||||
$oProfile->loadInLang($this->_iEditLang, $soxId);
|
||||
} else {
|
||||
$aParams[$oProfile->d3GetFieldLongName('oxid')] = null;
|
||||
}
|
||||
|
||||
$oProfile->setLanguage(0);
|
||||
|
||||
$oProfile->assign($aParams);
|
||||
$oProfile->setLanguage($this->_iEditLang);
|
||||
|
||||
$oProfile->prepareSaveData();
|
||||
|
||||
$oProfile->save();
|
||||
|
||||
// set oxid if inserted
|
||||
if ($soxId == "-1") {
|
||||
$this->_sSavedId = $oProfile->getId();
|
||||
}
|
||||
|
||||
$this->setEditObjectId($oProfile->getId());
|
||||
}
|
||||
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves article parameters in different language.
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveinnlang()
|
||||
{
|
||||
if (false == $this->_blUseOwnOxid) {
|
||||
return;
|
||||
}
|
||||
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
$aParams = Registry::get(Request::class)->getRequestEscapedParameter("editval");
|
||||
$oProfile = $this->_getLoadedProfile($soxId, $aParams);
|
||||
|
||||
$oProfile->setLanguage(0);
|
||||
$oProfile->assign($aParams);
|
||||
|
||||
// apply new language
|
||||
$sNewLanguage = Registry::get(Request::class)->getRequestEscapedParameter("new_lang");
|
||||
$oProfile->setLanguage($sNewLanguage);
|
||||
$oProfile->save();
|
||||
|
||||
// set for reload
|
||||
Registry::getSession()->setVariable("new_lang", $sNewLanguage);
|
||||
|
||||
// set oxid if inserted
|
||||
if ($soxId == "-1") {
|
||||
$this->_sSavedId = $oProfile->getId();
|
||||
}
|
||||
|
||||
$this->setEditObjectId($oProfile->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function d3savecopy()
|
||||
{
|
||||
if (false == $this->_blUseOwnOxid) {
|
||||
return;
|
||||
}
|
||||
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
$aParams = Registry::get(Request::class)->getRequestEscapedParameter("editval");
|
||||
$oProfile = $this->_getLoadedProfile($soxId, $aParams);
|
||||
$oProfile->saveCopy();
|
||||
|
||||
// set oxid if inserted
|
||||
$this->_sSavedId = $oProfile->getId();
|
||||
|
||||
$this->addTplParam("updatelist", "1");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $soxId
|
||||
* @param $aParams
|
||||
*
|
||||
* @return d3modprofile
|
||||
*/
|
||||
protected function _getLoadedProfile($soxId, $aParams)
|
||||
{
|
||||
// default values
|
||||
$aParams = $this->addDefaultValues($aParams);
|
||||
|
||||
/** @var d3modprofile $oProfile */
|
||||
$oProfile = oxNew($this->_sD3ObjectClass);
|
||||
$oProfile->setLanguage($this->_iEditLang);
|
||||
|
||||
if ($soxId != "-1") {
|
||||
$oProfile->load($soxId);
|
||||
} else {
|
||||
$aParams[$oProfile->d3GetFieldLongName('oxid')] = null;
|
||||
}
|
||||
|
||||
return $oProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function d3exportProfile()
|
||||
{
|
||||
/** @var d3modprofile $oProfile */
|
||||
$oProfile = oxNew($this->_sD3ObjectClass);
|
||||
$oProfile->setEnableMultilang(false);
|
||||
$soxId = Registry::get(Request::class)->getRequestEscapedParameter("oxid");
|
||||
$oProfile->load($soxId);
|
||||
$oProfile->exportItem('sql');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sStatus
|
||||
* @param $oSet
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogStatus($sStatus, $oSet = false)
|
||||
{
|
||||
return $this->d3GetSet()->getLogStatus($sStatus, $oSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserMessages()
|
||||
{
|
||||
return $this->_aMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function checkD3Log()
|
||||
{
|
||||
if ($this->d3getLog()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3_cfg_mod
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogSet()
|
||||
{
|
||||
return $this->d3getLog()->getLogSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetMenuItemTitle()
|
||||
{
|
||||
return $this->_sMenuItemTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3GetMenuSubItemTitle()
|
||||
{
|
||||
return $this->_sMenuSubItemTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getHelpURL()
|
||||
{
|
||||
$sUrl = $this->d3GetSet()->getHelpURL();
|
||||
/** @var d3filesystem $oFS */
|
||||
$oFS = oxNew(d3filesystem::class);
|
||||
|
||||
if ($this->_sHelpLinkMLAdd) {
|
||||
$sUrl .= $oFS->unprefixedslashit(Registry::getLang()->translateString($this->_sHelpLinkMLAdd));
|
||||
}
|
||||
|
||||
$aFileName = $oFS->splitFilename($sUrl);
|
||||
|
||||
// has no extension
|
||||
if (false == $aFileName['ext']) {
|
||||
$sUrl = $oFS->trailingslashit($sUrl);
|
||||
}
|
||||
|
||||
return $sUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getHasDebugSwitch()
|
||||
{
|
||||
return $this->_blHasDebugSwitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDebugHelpTextIdent()
|
||||
{
|
||||
return $this->_sDebugHelpTextIdent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getHasTestSwitch()
|
||||
{
|
||||
return $this->_blHasTestModeSwitch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTestModeHelpTextIdent()
|
||||
{
|
||||
return $this->_sTestModeHelpTextIdent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sLogType
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getLogTypeTranslation($sLogType)
|
||||
{
|
||||
return $this->d3getLog()->getLogTypeTranslation($sLogType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function d3getModId()
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* exampleItem: array('new' => array(
|
||||
* 'sScript' => 'top.oxid.admin.editThis( -1 );return false;',
|
||||
* 'sTranslationId' => 'foo',
|
||||
* )
|
||||
* @return array
|
||||
*/
|
||||
public function getNaviItems()
|
||||
{
|
||||
return $this->_aNaviItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function d3getAdditionalFormParams()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function fakeBottomMenu()
|
||||
{
|
||||
$myAdminNavig = new stdClass();
|
||||
$myAdminNavig->ordermanager_new = 1;
|
||||
$this->addTplParam('bottom_buttons', $myAdminNavig);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getFolderList()
|
||||
{
|
||||
/** @var d3modprofile $oProfile */
|
||||
$oProfile = oxNew($this->_sD3ObjectClass);
|
||||
return $oProfile->d3getFolderList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets default values for empty article (currently does nothing), returns
|
||||
* array with parameters.
|
||||
*
|
||||
* @param array $aParams Parameters, to set default values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function addDefaultValues($aParams)
|
||||
{
|
||||
return $aParams;
|
||||
}
|
||||
}
|
2
Application/Model/Configuration/d3_cfg_mod.php
Normal file
2
Application/Model/Configuration/d3_cfg_mod.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Configuration/d3_cfg_mod_datastore.php
Normal file
2
Application/Model/Configuration/d3_cfg_mod_datastore.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Configuration/d3_cfg_mod_variant.php
Normal file
2
Application/Model/Configuration/d3_cfg_mod_variant.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Configuration/d3_license_app.php
Normal file
2
Application/Model/Configuration/d3_license_app.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Configuration/d3modprofile.php
Normal file
2
Application/Model/Configuration/d3modprofile.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Configuration/d3modprofilelist.php
Normal file
2
Application/Model/Configuration/d3modprofilelist.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
23
Application/Model/Constants.php
Normal file
23
Application/Model/Constants.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model;
|
||||
|
||||
class Constants
|
||||
{
|
||||
public const OXID_MODULE_ID = 'd3modcfg_lib';
|
||||
}
|
203
Application/Model/Encoding/d3decoder.php
Normal file
203
Application/Model/Encoding/d3decoder.php
Normal file
@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Encoding;
|
||||
|
||||
use JsonException;
|
||||
|
||||
class d3decoder
|
||||
{
|
||||
public const DEC_DEFAULT = 'default';
|
||||
public const DEC_JSON = 'json';
|
||||
public const DEC_UTF8 = 'utf-8';
|
||||
public const DEC_GZIP = 'gzip';
|
||||
public const DEC_SERIALIZE = 'serialize';
|
||||
public const DEC_RAWURL = 'rawurl';
|
||||
public const DEC_URL = 'url';
|
||||
public const DEC_BASE64 = 'base64';
|
||||
public const DEC_UUENC = 'uuencode';
|
||||
public const DEC_QUOTED = 'quoted';
|
||||
|
||||
/**
|
||||
* @param string $_sDecodingType
|
||||
*/
|
||||
public function __construct(protected string $_sDecodingType = self::DEC_DEFAULT)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDecodingType(): string
|
||||
{
|
||||
return $this->_sDecodingType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function decode(?string $encodedValue): mixed
|
||||
{
|
||||
return match (strtolower($this->getDecodingType())) {
|
||||
self::DEC_JSON => $this->decodeJson($encodedValue),
|
||||
self::DEC_UTF8 => $this->decodeUtf8($encodedValue),
|
||||
self::DEC_GZIP => $this->decodeGZip($encodedValue),
|
||||
self::DEC_SERIALIZE => $this->decodeSerialize($encodedValue),
|
||||
self::DEC_RAWURL => $this->decodeRawUrl($encodedValue),
|
||||
self::DEC_URL => $this->decodeUrl($encodedValue),
|
||||
self::DEC_BASE64 => $this->decodeBase64($encodedValue),
|
||||
self::DEC_UUENC => $this->decodeUUEncode($encodedValue),
|
||||
self::DEC_QUOTED => $this->decodeQuotedPrintable($encodedValue),
|
||||
default => $this->decodeDefault($encodedValue)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeDefault(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
rawurldecode(
|
||||
base64_decode($encodedValue ?? '')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function decodeJson(?string $encodedValue): mixed
|
||||
{
|
||||
return json_decode(
|
||||
html_entity_decode($encodedValue ?? '', ENT_QUOTES),
|
||||
null,
|
||||
512,
|
||||
JSON_THROW_ON_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeUtf8(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
utf8_decode(
|
||||
html_entity_decode($encodedValue ?? '', ENT_QUOTES)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeSerialize(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
html_entity_decode($encodedValue ?? '', ENT_QUOTES)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeUrl(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
urldecode($encodedValue ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeRawUrl(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
rawurldecode($encodedValue ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function decodeBase64(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
base64_decode($encodedValue ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeGZip(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
gzdecode(
|
||||
html_entity_decode($encodedValue ?? '', ENT_QUOTES)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeUUEncode(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
convert_uudecode(
|
||||
html_entity_decode($encodedValue ?? '', ENT_QUOTES)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $encodedValue
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function decodeQuotedPrintable(?string $encodedValue): mixed
|
||||
{
|
||||
return unserialize(
|
||||
quoted_printable_decode(
|
||||
html_entity_decode($encodedValue ?? '', ENT_QUOTES)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
206
Application/Model/Encoding/d3encoder.php
Normal file
206
Application/Model/Encoding/d3encoder.php
Normal file
@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Encoding;
|
||||
|
||||
use JsonException;
|
||||
|
||||
class d3encoder
|
||||
{
|
||||
public const ENC_DEFAULT = 'default';
|
||||
public const ENC_JSON = 'json';
|
||||
public const ENC_UTF8 = 'utf-8';
|
||||
public const ENC_GZIP = 'gzip';
|
||||
public const ENC_SERIALIZE = 'serialize';
|
||||
public const ENC_RAWURL = 'rawurl';
|
||||
public const ENC_URL = 'url';
|
||||
public const ENC_BASE64 = 'base64';
|
||||
public const ENC_UUENC = 'uuencode';
|
||||
public const ENC_QUOTED = 'quoted';
|
||||
|
||||
/**
|
||||
* @param string $_sEncodingType
|
||||
*/
|
||||
public function __construct(protected string $_sEncodingType = self::ENC_DEFAULT)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEncodingType(): string
|
||||
{
|
||||
return $this->_sEncodingType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function encode(mixed $decodedValue): string
|
||||
{
|
||||
return match (strtolower($this->getEncodingType())) {
|
||||
self::ENC_JSON => $this->encodeJson($decodedValue),
|
||||
self::ENC_UTF8 => $this->encodeUtf8($decodedValue),
|
||||
self::ENC_GZIP => $this->encodeGZip($decodedValue),
|
||||
self::ENC_SERIALIZE => $this->encodeSerialize($decodedValue),
|
||||
self::ENC_RAWURL => $this->encodeRawUrl($decodedValue),
|
||||
self::ENC_URL => $this->encodeUrl($decodedValue),
|
||||
self::ENC_BASE64 => $this->encodeBase64($decodedValue),
|
||||
self::ENC_UUENC => $this->encodeUUEncode($decodedValue),
|
||||
self::ENC_QUOTED => $this->encodeQuotedPrintable($decodedValue),
|
||||
default => $this->encodeDefault($decodedValue)
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeDefault(mixed $decodedValue): string
|
||||
{
|
||||
return base64_encode(
|
||||
rawurlencode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function encodeJson(mixed $decodedValue): string
|
||||
{
|
||||
return json_encode($decodedValue, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeUtf8(mixed $decodedValue): string
|
||||
{
|
||||
return utf8_encode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeSerialize(mixed $decodedValue): string
|
||||
{
|
||||
return serialize(
|
||||
$decodedValue
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeUrl(mixed $decodedValue): string
|
||||
{
|
||||
return urlencode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeRawUrl(mixed $decodedValue): string
|
||||
{
|
||||
return rawurlencode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeBase64(mixed $decodedValue): string
|
||||
{
|
||||
return base64_encode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeGZip(mixed $decodedValue): string
|
||||
{
|
||||
return gzencode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeUUEncode(mixed $decodedValue): string
|
||||
{
|
||||
return convert_uuencode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $decodedValue
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encodeQuotedPrintable(mixed $decodedValue): string
|
||||
{
|
||||
return quoted_printable_encode(
|
||||
serialize(
|
||||
$decodedValue
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
30
Application/Model/Exception/d3ParameterNotFoundException.php
Normal file
30
Application/Model/Exception/d3ParameterNotFoundException.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class d3ParameterNotFoundException extends StandardException
|
||||
{
|
||||
/**
|
||||
* @param string $sKey
|
||||
* @param int $iCode
|
||||
*/
|
||||
public function __construct(public $sKey, $iCode = 0)
|
||||
{
|
||||
parent::__construct($sKey . ' not set', $iCode);
|
||||
}
|
||||
}
|
22
Application/Model/Exception/d3PreventExitException.php
Normal file
22
Application/Model/Exception/d3PreventExitException.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class d3PreventExitException extends StandardException
|
||||
{
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class d3ShopCompatibilityAdapterException extends StandardException
|
||||
{
|
||||
}
|
60
Application/Model/Exception/d3_cfg_mod_exception.php
Normal file
60
Application/Model/Exception/d3_cfg_mod_exception.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* handle d3_cfg_mod specific exceptions
|
||||
*/
|
||||
class d3_cfg_mod_exception extends d3modprofile_exception
|
||||
{
|
||||
protected $_sCompareData;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getString()
|
||||
{
|
||||
$sStr = self::class . " (time: " . (new DateTimeImmutable())->format('Y-m-d H:i:s')
|
||||
. "): [{$this->code}]: {$this->message} ";
|
||||
|
||||
if ($this->getCompareData()) {
|
||||
$sStr .= "(".$this->getCompareData().") ";
|
||||
}
|
||||
|
||||
$sStr .= "- Faulty ModCfg: " . $this->getModCfgId();
|
||||
//." \n Stack Trace: {$this->getTraceAsString()}\n\n";
|
||||
|
||||
return $sStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sCompareData
|
||||
*/
|
||||
public function setCompareData($sCompareData)
|
||||
{
|
||||
$this->_sCompareData = $sCompareData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCompareData()
|
||||
{
|
||||
return $this->_sCompareData;
|
||||
}
|
||||
}
|
101
Application/Model/Exception/d3log_exception.php
Normal file
101
Application/Model/Exception/d3log_exception.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use D3\ModCfg\Application\Model\Log\d3log;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3log_exception extends StandardException
|
||||
{
|
||||
/** @var d3log */
|
||||
public $oD3Log;
|
||||
public $iErrorLevel;
|
||||
public $sLogText;
|
||||
|
||||
/**
|
||||
* @param d3log $oD3Log
|
||||
* @param int $iErrorLevel
|
||||
* @param $sMessage
|
||||
*/
|
||||
public function __construct(d3log $oD3Log, $iErrorLevel = d3log::ERROR, $sMessage = "not set")
|
||||
{
|
||||
$this->setLog($oD3Log);
|
||||
$this->setErrorLevel($iErrorLevel);
|
||||
|
||||
parent::__construct($sMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param d3log $oD3Log
|
||||
*/
|
||||
public function setLog(d3log $oD3Log)
|
||||
{
|
||||
$this->oD3Log = $oD3Log;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iErrorLevel
|
||||
*/
|
||||
public function setErrorLevel($iErrorLevel = d3log::ERROR)
|
||||
{
|
||||
$this->iErrorLevel = $iErrorLevel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $sMessage
|
||||
*/
|
||||
public function setLogText($sMessage)
|
||||
{
|
||||
$this->sLogText = $sMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLogText()
|
||||
{
|
||||
return $this->sLogText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|void
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function debugOut()
|
||||
{
|
||||
$logger = Registry::getLogger();
|
||||
$logger->error($this);
|
||||
|
||||
$this->oD3Log->log(
|
||||
$this->iErrorLevel,
|
||||
self::class,
|
||||
__FUNCTION__,
|
||||
__LINE__,
|
||||
$this->getMessage(),
|
||||
$this->getLogText()
|
||||
);
|
||||
}
|
||||
}
|
95
Application/Model/Exception/d3modprofile_exception.php
Normal file
95
Application/Model/Exception/d3modprofile_exception.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Utils;
|
||||
|
||||
/**
|
||||
* handle d3modprofile specific exceptions
|
||||
*/
|
||||
class d3modprofile_exception extends StandardException
|
||||
{
|
||||
private $_sModId;
|
||||
|
||||
protected $_sType;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getString()
|
||||
{
|
||||
return self::class . " (time: " . (new DateTimeImmutable())->format('Y-m-d H:i:s')
|
||||
. "): [{$this->code}]: {$this->message} - Faulty ModProfile: " . $this->getModCfgId();
|
||||
//." \n Stack Trace: {$this->getTraceAsString()}\n\n";
|
||||
}
|
||||
|
||||
public function debugOut()
|
||||
{
|
||||
//We are most likely are already dealing with an exception so making sure no other exceptions interfere
|
||||
try {
|
||||
$sLogMsg = $this->getString() . "\n Stack Trace: {$this->getTraceAsString(
|
||||
)} \n---------------------------------------------\n";
|
||||
|
||||
$logger = Registry::getLogger();
|
||||
$logger->error($sLogMsg);
|
||||
} catch (Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModId
|
||||
*/
|
||||
public function setModCfgId($sModId)
|
||||
{
|
||||
$this->_sModId = $sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModCfgId()
|
||||
{
|
||||
return $this->_sModId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sType
|
||||
*/
|
||||
public function setExcType($sType)
|
||||
{
|
||||
$this->_sType = $sType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExcType()
|
||||
{
|
||||
return $this->_sType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExcMessage()
|
||||
{
|
||||
return $this->message;
|
||||
}
|
||||
}
|
28
Application/Model/Exception/wrongModIdException.php
Normal file
28
Application/Model/Exception/wrongModIdException.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Exception;
|
||||
|
||||
use Exception;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class wrongModIdException extends StandardException
|
||||
{
|
||||
public function __construct($sModId = "not set", $iCode = 0, Exception $previous = null)
|
||||
{
|
||||
$sMessage = 'wrong or unknown module ID: '.$sModId;
|
||||
parent::__construct($sMessage, $iCode, $previous);
|
||||
}
|
||||
}
|
2
Application/Model/FileSizeFormatter.php
Normal file
2
Application/Model/FileSizeFormatter.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
191
Application/Model/Filegenerator/d3filegenerator.php
Normal file
191
Application/Model/Filegenerator/d3filegenerator.php
Normal file
@ -0,0 +1,191 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Filegenerator;
|
||||
|
||||
use D3\ModCfg\Application\Model\d3filesystem;
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRenderer;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateRendererBridgeInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3filegenerator
|
||||
{
|
||||
protected array $_aContentList = [];
|
||||
|
||||
protected ?string $_sContentType = null;
|
||||
protected string $_sContentNameBaseKey = 'D3_FILEGENERATOR_';
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getContentList(): array
|
||||
{
|
||||
$aContentList = [];
|
||||
|
||||
foreach (array_keys($this->_aContentList) as $sKey) {
|
||||
$aContentList[$sKey] = $this->_translateContentName($sKey);
|
||||
}
|
||||
|
||||
return $aContentList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sType
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isInContentList(string $sType): bool
|
||||
{
|
||||
return in_array($sType, array_keys($this->_aContentList));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sType
|
||||
* @param string $sTemplateName
|
||||
*/
|
||||
public function addToContentList(string $sType, string $sTemplateName): void
|
||||
{
|
||||
$this->_aContentList[$sType] = $sTemplateName;
|
||||
$this->setContentType($sType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sType
|
||||
*/
|
||||
public function removeFromContentList(string $sType): void
|
||||
{
|
||||
if ($this->isInContentList($sType)) {
|
||||
unset($this->_aContentList[$sType]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sContentType
|
||||
*/
|
||||
public function setContentType(string $sContentType): void
|
||||
{
|
||||
$this->_sContentType = $sContentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _translateContentName(string $sKey): string
|
||||
{
|
||||
return Registry::getLang()->translateString($this->_sContentNameBaseKey.strtoupper($sKey), null, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDownloadFileName
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function startDownload(string $sDownloadFileName): void
|
||||
{
|
||||
$sContent = $this->_getFileContent();
|
||||
|
||||
/** @var d3filesystem $oD3FS */
|
||||
$oD3FS = oxNew(d3filesystem::class);
|
||||
$oD3FS->startDirectDownload($sDownloadFileName, $sContent);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sFilePath
|
||||
* @param bool $blOverwrite
|
||||
* @param int|null $sChmod
|
||||
*
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
*/
|
||||
public function createFile(string $sFilePath, bool $blOverwrite = true, int $sChmod = null): bool
|
||||
{
|
||||
$sContent = $this->_getFileContent();
|
||||
|
||||
/** @var d3filesystem $oD3FS */
|
||||
$oD3FS = oxNew(d3filesystem::class);
|
||||
return $oD3FS->createFile($sFilePath, $sContent, $blOverwrite, $sChmod);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws StandardException
|
||||
*/
|
||||
protected function _getFileContent(): string
|
||||
{
|
||||
if (! $this->isInContentList($this->_sContentType)) {
|
||||
/** @var StandardException $oException */
|
||||
$oException = oxNew(StandardException::class, 'no valid content source set');
|
||||
throw($oException);
|
||||
}
|
||||
|
||||
$templateRenderer = $this->getTemplateRenderer();
|
||||
|
||||
$sTemplate = $this->_aContentList[$this->_sContentType];
|
||||
return $templateRenderer->renderTemplate($sTemplate, $this->getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TemplateRenderer
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function getTemplateRenderer(): TemplateRenderer
|
||||
{
|
||||
return ContainerFactory::getInstance()->getContainer()
|
||||
->get(TemplateRendererBridgeInterface::class)
|
||||
->getTemplateRenderer();
|
||||
}
|
||||
|
||||
protected function getContext(): array
|
||||
{
|
||||
return [
|
||||
'oShop' => Registry::getConfig()->getActiveShop(),
|
||||
'oConfig' => Registry::getConfig(),
|
||||
'oViewConf' => Registry::getConfig()->getActiveView()->getViewConfig(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPHPInterpreterPath(): string
|
||||
{
|
||||
return PHP_BINDIR;
|
||||
}
|
||||
}
|
65
Application/Model/Filegenerator/d3filegeneratorcronsh.php
Normal file
65
Application/Model/Filegenerator/d3filegeneratorcronsh.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Filegenerator;
|
||||
|
||||
use D3\ModCfg\Application\Model\Constants;
|
||||
|
||||
class d3filegeneratorcronsh extends d3filegenerator
|
||||
{
|
||||
protected string $_sContentNameBaseKey = 'D3_SHGENERATOR_CRON_';
|
||||
protected ?string $_sScriptPath = null;
|
||||
protected array $_aSortedParameterList = [];
|
||||
|
||||
protected array $_aContentList = [
|
||||
'standard' => '@'.Constants::OXID_MODULE_ID.'/admin/pattern/sh_cron_standard',
|
||||
'profihost_php80' => '@'.Constants::OXID_MODULE_ID.'/admin/pattern/sh_cron_profihost80',
|
||||
'profihost_php81' => '@'.Constants::OXID_MODULE_ID.'/admin/pattern/sh_cron_profihost81',
|
||||
'profihost_php82' => '@'.Constants::OXID_MODULE_ID.'/admin/pattern/sh_cron_profihost82',
|
||||
'profihost_php83' => '@'.Constants::OXID_MODULE_ID.'/admin/pattern/sh_cron_profihost83',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param $sPath
|
||||
*/
|
||||
public function setScriptPath($sPath): void
|
||||
{
|
||||
$this->_sScriptPath = $sPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aParameterList
|
||||
*/
|
||||
public function setSortedParameterList(array $aParameterList): void
|
||||
{
|
||||
ksort($aParameterList);
|
||||
$this->_aSortedParameterList = $aParameterList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getContext(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::getContext(),
|
||||
[
|
||||
'sPHPInterpreterPath' => $this->getPHPInterpreterPath(),
|
||||
'sScriptPath' => $this->_sScriptPath ?: null,
|
||||
'aParameters' => $this->_aSortedParameterList ?: null,
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
2
Application/Model/Install/d3debughandler.php
Normal file
2
Application/Model/Install/d3debughandler.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Install/d3install.php
Normal file
2
Application/Model/Install/d3install.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Install/d3install_updatebase.php
Normal file
2
Application/Model/Install/d3install_updatebase.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Install/d3licenceserver.php
Normal file
2
Application/Model/Install/d3licenceserver.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Install/d3updateinstaller.php
Normal file
2
Application/Model/Install/d3updateinstaller.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Install/d3updateserver.php
Normal file
2
Application/Model/Install/d3updateserver.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
@ -0,0 +1,251 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Installcheck;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use Doctrine\DBAL\ParameterType;
|
||||
use OxidEsales\Eshop\Application\Model\Shop;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Module\Module;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class d3InstallCheckBlockItemsAreActive implements d3InstallCheckInterface
|
||||
{
|
||||
protected $_blResult;
|
||||
protected $_sPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKBLOCKITEMSOK';
|
||||
protected $_sNotPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKBLOCKITEMSNOK';
|
||||
protected $_sCheckDescML = 'D3_CFG_MOD_INSTALLCHECKBLOCKITEMS_DESC';
|
||||
protected $_blPassed = null;
|
||||
protected $_aDetails;
|
||||
protected $_blForceError = false;
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $_oSet
|
||||
*/
|
||||
public function __construct(protected d3_cfg_mod $_oSet)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function hasCheckPassed()
|
||||
{
|
||||
$sMetaModuleId = $this->_oSet->getMetaModuleId();
|
||||
|
||||
if ($this->_blPassed === null) {
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
$this->_blPassed = true;
|
||||
if ($sMetaModuleId) {
|
||||
/** @var Module $oModule */
|
||||
$oModule = oxNew(Module::class);
|
||||
$oModule->load($sMetaModuleId);
|
||||
|
||||
if (is_array($oModule->getInfo('blocks'))) {
|
||||
$this->_blPassed = $this->_checkAllBlockItemsExist($oModule->getInfo('blocks'), $sMetaModuleId);
|
||||
}
|
||||
}
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_blPassed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getCheckMessageMultilangItem()
|
||||
{
|
||||
if ($this->hasCheckPassed()) {
|
||||
return $this->_sPassedCheckML;
|
||||
}
|
||||
|
||||
return $this->_sNotPassedCheckML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aBlockExtensions
|
||||
* @param $sModuleId
|
||||
* @return bool
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
*/
|
||||
protected function _checkAllBlockItemsExist($aBlockExtensions, $sModuleId)
|
||||
{
|
||||
$aBlockExtensions = $this->_setErrorCase($aBlockExtensions);
|
||||
|
||||
if (count($aBlockExtensions) == $this->_getActiveModuleBlockCount($sModuleId)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModuleId
|
||||
*
|
||||
* @return int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function _getActiveModuleBlockCount($sModuleId)
|
||||
{
|
||||
/** @var Shop $shop */
|
||||
$shop = Registry::getConfig()->getActiveShop();
|
||||
$oQB = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
|
||||
$oQB->select('count(*)')
|
||||
->from('oxtplblocks')
|
||||
->where('oxmodule = '.$oQB->createNamedParameter($sModuleId))
|
||||
->andWhere('oxactive = '.$oQB->createNamedParameter(1, ParameterType::INTEGER))
|
||||
->andWhere('oxshopid = '.$oQB->createNamedParameter($shop->getId()))
|
||||
->setMaxResults(1);
|
||||
|
||||
return (int) $oQB->execute()->fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCheckDescMultiLangItem()
|
||||
{
|
||||
return $this->_sCheckDescML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
public function getDetails()
|
||||
{
|
||||
if (false == $this->hasCheckPassed()) {
|
||||
if ($this->_aDetails == null) {
|
||||
$aMissingBlocks = [];
|
||||
$sMetaModuleId = $this->_oSet->getMetaModuleId();
|
||||
|
||||
if ($sMetaModuleId) {
|
||||
/** @var Module $oModule */
|
||||
$oModule = oxNew(Module::class);
|
||||
$oModule->load($sMetaModuleId);
|
||||
$aMetaBlocks = $oModule->getInfo('blocks');
|
||||
|
||||
$aMissingBlocks = $this->_getMissingBlockList($sMetaModuleId, $aMetaBlocks, $aMissingBlocks);
|
||||
}
|
||||
|
||||
$this->_aDetails = $aMissingBlocks;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_aDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sModuleId
|
||||
*
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function _getActiveModuleBlocks($sModuleId)
|
||||
{
|
||||
/** @var Shop $shop */
|
||||
$shop = Registry::getConfig()->getActiveShop();
|
||||
$oQB = ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
|
||||
$oQB->select('oxfile')
|
||||
->from('oxtplblocks')
|
||||
->where('oxmodule = '.$oQB->createNamedParameter($sModuleId))
|
||||
->andWhere('oxactive = '.$oQB->createNamedParameter(1, ParameterType::INTEGER))
|
||||
->andWhere('oxshopid = '.$oQB->createNamedParameter($shop->getId()));
|
||||
|
||||
return $oQB->execute()->fetchAllAssociative();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sMetaModuleId
|
||||
* @param $aMetaBlocks
|
||||
* @param $aMissingBlocks
|
||||
* @return array
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
protected function _getMissingBlockList($sMetaModuleId, $aMetaBlocks, $aMissingBlocks)
|
||||
{
|
||||
$aMetaBlocks = $this->_getNonAvailableMetaBlocks($sMetaModuleId, $aMetaBlocks);
|
||||
|
||||
foreach ($aMetaBlocks as $aMetaBlock) {
|
||||
$aMissingBlocks[] = $aMetaBlock['file'];
|
||||
}
|
||||
|
||||
return $aMissingBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sMetaModuleId
|
||||
* @param $aMetaBlocks
|
||||
* @return array
|
||||
* @throws DBALException
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
*/
|
||||
protected function _getNonAvailableMetaBlocks($sMetaModuleId, $aMetaBlocks)
|
||||
{
|
||||
$aMetaBlocks = $this->_setErrorCase($aMetaBlocks);
|
||||
|
||||
foreach ($this->_getActiveModuleBlocks($sMetaModuleId) as $aBlockFile) {
|
||||
$aBlockFile = array_change_key_case($aBlockFile, CASE_UPPER);
|
||||
foreach ($aMetaBlocks as $sKey => $aMetaBlock) {
|
||||
if ($aMetaBlock['file'] == $aBlockFile['OXFILE']) {
|
||||
unset($aMetaBlocks[$sKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aMetaBlocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $aMetaBlocks
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _setErrorCase($aMetaBlocks)
|
||||
{
|
||||
if ($this->_blForceError) {
|
||||
$aMetaBlocks[] = ['template' => 'org.tpl', 'block' => 'myBlock', 'file' => 'myfolder/file.tpl'];
|
||||
}
|
||||
|
||||
return $aMetaBlocks;
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Installcheck;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use OxidEsales\Eshop\Core\Module\Module;
|
||||
use OxidEsales\Eshop\Core\Module\ModuleList;
|
||||
|
||||
class d3InstallCheckExtendItemsAreActive implements d3InstallCheckInterface
|
||||
{
|
||||
protected $_blResult;
|
||||
protected $_sPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKEXTENDITEMSOK';
|
||||
protected $_sNotPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKEXTENDITEMSNOK';
|
||||
protected $_sCheckDescML = 'D3_CFG_MOD_INSTALLCHECKEXTENDITEMS_DESC';
|
||||
protected $_blPassed;
|
||||
protected $_aDetails;
|
||||
protected $_blForceError = false;
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $_oSet
|
||||
*/
|
||||
public function __construct(protected d3_cfg_mod $_oSet)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCheckPassed()
|
||||
{
|
||||
if ($this->_blPassed === null) {
|
||||
$this->_blPassed = true;
|
||||
if ($this->_oSet->getMetaModuleId()) {
|
||||
/** @var Module $oModule */
|
||||
$oModule = oxNew(Module::class);
|
||||
$oModule->load($this->_oSet->getMetaModuleId());
|
||||
|
||||
$oModulelist = oxNew(ModuleList::class);
|
||||
$aDisabledModules = $oModulelist->getDisabledModuleClasses();
|
||||
|
||||
if (is_array($oModule->getInfo('extend'))) {
|
||||
$this->_blPassed = $this->_checkAllModuleItemsExist($oModule->getInfo('extend'), $aDisabledModules);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_blPassed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCheckMessageMultilangItem()
|
||||
{
|
||||
if ($this->hasCheckPassed()) {
|
||||
return $this->_sPassedCheckML;
|
||||
}
|
||||
|
||||
return $this->_sNotPassedCheckML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aModuleExtensions
|
||||
* @param $aDisabledModules
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _checkAllModuleItemsExist($aModuleExtensions, $aDisabledModules)
|
||||
{
|
||||
$aModuleExtensions = $this->_setErrorCase($aModuleExtensions);
|
||||
$aDisabledModules = $this->_setErrorCase($aDisabledModules);
|
||||
|
||||
foreach ($aModuleExtensions as $sModule) {
|
||||
if (is_array($aDisabledModules) && in_array($sModule, $aDisabledModules)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCheckDescMultiLangItem()
|
||||
{
|
||||
return $this->_sCheckDescML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null|false
|
||||
*/
|
||||
public function getDetails()
|
||||
{
|
||||
if (false == $this->hasCheckPassed()) {
|
||||
if ($this->_aDetails == null) {
|
||||
$aMissingExtensions = [];
|
||||
$sMetaModuleId = $this->_oSet->getMetaModuleId();
|
||||
|
||||
if ($sMetaModuleId) {
|
||||
/** @var Module $oModule */
|
||||
$oModule = oxNew(Module::class);
|
||||
$oModule->load($sMetaModuleId);
|
||||
$aMetaExtensions = $oModule->getInfo('extend');
|
||||
|
||||
$aMissingExtensions = $this->_getNonAvailableMetaExtensions($aMetaExtensions);
|
||||
}
|
||||
|
||||
$this->_aDetails = $aMissingExtensions;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_aDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aMetaFiles
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _getNonAvailableMetaExtensions($aMetaFiles)
|
||||
{
|
||||
/** @var ModuleList $oModulelist */
|
||||
$oModulelist = oxNew(ModuleList::class);
|
||||
$aDisabledModules = $oModulelist->getDisabledModuleClasses();
|
||||
|
||||
$aMetaFiles = $this->_setErrorCase($aMetaFiles);
|
||||
$aDisabledModules = $this->_setErrorCase($aDisabledModules);
|
||||
|
||||
$aMissingExtensions = [];
|
||||
foreach ($aDisabledModules as $sModuleFile) {
|
||||
foreach ($aMetaFiles as $sMetaFile) {
|
||||
if ($sMetaFile == $sModuleFile) {
|
||||
$aMissingExtensions[] = $sModuleFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aMissingExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aMetaData
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _setErrorCase($aMetaData)
|
||||
{
|
||||
if ($this->_blForceError) {
|
||||
$aMetaData['orgClass'] = 'myfolder/extension.php';
|
||||
}
|
||||
|
||||
return $aMetaData;
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Installcheck;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use D3\ModCfg\Application\Model\Install\d3install_updatebase;
|
||||
use D3\ModCfg\Application\Model\Install\d3updateinstaller;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
use OxidEsales\Eshop\Core\Exception\SystemComponentException;
|
||||
|
||||
class d3InstallCheckHasNoInstallItem implements d3InstallCheckInterface
|
||||
{
|
||||
protected $_blResult;
|
||||
protected $_sPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKINSTALLITEMSOK';
|
||||
protected $_sNotPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKINSTALLITEMSNOK';
|
||||
protected $_sCheckDescML = 'D3_CFG_MOD_INSTALLCHECKINSTALLITEMS_DESC';
|
||||
protected $_blPassed;
|
||||
protected $_aDetails;
|
||||
protected $_blForceError = false;
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $_oSet
|
||||
*/
|
||||
public function __construct(protected d3_cfg_mod $_oSet)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
*/
|
||||
public function hasCheckPassed()
|
||||
{
|
||||
if ($this->_blPassed === null) {
|
||||
$this->_blPassed = true;
|
||||
|
||||
/** @var d3updateinstaller $oUpdateInstaller */
|
||||
$oUpdateInstaller = oxNew(d3updateinstaller::class);
|
||||
$aSetupClasses = $oUpdateInstaller->getSetupClasses($this->_oSet->getMetaModuleId());
|
||||
|
||||
if (is_array($aSetupClasses) && count($aSetupClasses)) {
|
||||
foreach ($aSetupClasses as $sFQClassName) {
|
||||
/** @var d3install_updatebase $oUpdate */
|
||||
$oUpdate = oxNew($sFQClassName);
|
||||
if ($this->_blForceError || $oUpdate->isUpdateRequired(false)) {
|
||||
$this->_blPassed = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_blPassed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws StandardException
|
||||
* @throws SystemComponentException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
*/
|
||||
public function getCheckMessageMultilangItem()
|
||||
{
|
||||
if ($this->hasCheckPassed()) {
|
||||
return $this->_sPassedCheckML;
|
||||
}
|
||||
|
||||
return $this->_sNotPassedCheckML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCheckDescMultiLangItem()
|
||||
{
|
||||
return $this->_sCheckDescML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aFileInfos
|
||||
*
|
||||
* @return bool|mixed
|
||||
*/
|
||||
protected function _isUpdateScript($aFileInfos)
|
||||
{
|
||||
$sSearchPattern = "^d3.*_update.php$";
|
||||
|
||||
if ((strstr($aFileInfos['dir'], 'models') ||
|
||||
strstr($aFileInfos['dir'], 'setup')) &&
|
||||
preg_match('@'.$sSearchPattern.'@', $aFileInfos['file'])
|
||||
) {
|
||||
return str_replace('.php', '', $aFileInfos['file']);
|
||||
};
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getDetails()
|
||||
{
|
||||
return $this->_aDetails;
|
||||
}
|
||||
}
|
37
Application/Model/Installcheck/d3InstallCheckInterface.php
Normal file
37
Application/Model/Installcheck/d3InstallCheckInterface.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Installcheck;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
|
||||
/**
|
||||
* Interface d3InstallCheckInterface
|
||||
*/
|
||||
interface d3InstallCheckInterface
|
||||
{
|
||||
/**
|
||||
* @param d3_cfg_mod $oSet
|
||||
*/
|
||||
public function __construct(d3_cfg_mod $oSet);
|
||||
|
||||
public function hasCheckPassed();
|
||||
|
||||
public function getCheckMessageMultilangItem();
|
||||
|
||||
public function getCheckDescMultiLangItem();
|
||||
|
||||
public function getDetails();
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Installcheck;
|
||||
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use OxidEsales\Eshop\Core\ConfigFile;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\Module\Module;
|
||||
|
||||
class d3InstallCheckModuleVersionsIdentical implements d3InstallCheckInterface
|
||||
{
|
||||
protected $_blResult;
|
||||
protected $_sPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKVERSIONIDENTICALSOK';
|
||||
protected $_sNotPassedCheckML = 'D3_CFG_MOD_INSTALLCHECKVERSIONIDENTICALSNOK';
|
||||
protected $_sCheckDescML = 'D3_CFG_MOD_INSTALLCHECKVERSIONIDENTICALS_DESC';
|
||||
protected $_blPassed;
|
||||
protected $_aDetails;
|
||||
protected $_blForceError = false;
|
||||
|
||||
/**
|
||||
* @param d3_cfg_mod $_oSet
|
||||
*/
|
||||
public function __construct(protected d3_cfg_mod $_oSet)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCheckPassed()
|
||||
{
|
||||
if ($this->_blPassed === null) {
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
startProfile(__METHOD__);
|
||||
}
|
||||
if (false == $this->_oSet->getMetaModuleId()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @var Module $oModule */
|
||||
$oModule = oxNew(Module::class);
|
||||
$oModule->load($this->_oSet->getMetaModuleId());
|
||||
$this->_blPassed = $this->_compareModuleVersions($oModule->getInfo('version'));
|
||||
if ((bool) Registry::get(ConfigFile::class)->getVar('iDebug')) {
|
||||
stopProfile(__METHOD__);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_blPassed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCheckMessageMultilangItem()
|
||||
{
|
||||
if ($this->hasCheckPassed()) {
|
||||
return $this->_sPassedCheckML;
|
||||
}
|
||||
|
||||
return $this->_sNotPassedCheckML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCheckDescMultiLangItem()
|
||||
{
|
||||
return $this->_sCheckDescML;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $moduleVersion
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function _compareModuleVersions($moduleVersion)
|
||||
{
|
||||
$moduleVersions = $this->_setErrorCase($moduleVersion);
|
||||
|
||||
if (isset($moduleVersion) &&
|
||||
$moduleVersion == $this->_oSet->getModVersion()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDetails()
|
||||
{
|
||||
if (false == $this->hasCheckPassed()) {
|
||||
if ($this->_aDetails == null) {
|
||||
$oModule = oxNew(Module::class);
|
||||
$oModule->load($this->_oSet->getMetaModuleId());
|
||||
$metaDataModuleVersion = $oModule->getInfo('version');
|
||||
|
||||
$metaDataModuleVersion = $this->_setErrorCase($metaDataModuleVersion);
|
||||
|
||||
$this->_aDetails[] =
|
||||
Registry::getLang()->translateString('D3_CFG_MOD_INSTALLCHECKVERSIONIDENTICALS_MDV', null, true) .
|
||||
" ".$metaDataModuleVersion;
|
||||
$this->_aDetails[] =
|
||||
Registry::getLang()->translateString('D3_CFG_MOD_INSTALLCHECKVERSIONIDENTICALS_MCV', null, true) .
|
||||
" ".$this->_oSet->getModVersion();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_aDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aMetaData
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function _setErrorCase($aMetaData)
|
||||
{
|
||||
if ($this->_blForceError) {
|
||||
$aMetaData[$this->_oSet->getMetaModuleId()] = '900.0.0.0';
|
||||
}
|
||||
|
||||
return $aMetaData;
|
||||
}
|
||||
}
|
91
Application/Model/Installcheck/d3installcheck.php
Normal file
91
Application/Model/Installcheck/d3installcheck.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Installcheck;
|
||||
|
||||
use D3\ModCfg\Application\Model\Parametercontainer\d3ParameterContainer;
|
||||
use D3\ModCfg\Application\Model\Configuration\d3_cfg_mod;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ParameterNotFoundException;
|
||||
use OxidEsales\Eshop\Core\Model\BaseModel;
|
||||
use OxidEsales\Eshop\Core\Model\ListModel;
|
||||
|
||||
class d3installcheck extends ListModel
|
||||
{
|
||||
/** @var d3ParameterContainer */
|
||||
public $oParameterContainer;
|
||||
public $aInstallCheckItems = [
|
||||
d3InstallCheckModuleVersionsIdentical::class,
|
||||
d3InstallCheckExtendItemsAreActive::class,
|
||||
d3InstallCheckBlockItemsAreActive::class,
|
||||
d3InstallCheckHasNoInstallItem::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* d3installcheck constructor.
|
||||
* @param d3_cfg_mod $oModCfg
|
||||
* @throws d3ParameterNotFoundException
|
||||
*/
|
||||
public function __construct(d3_cfg_mod $oModCfg)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->oParameterContainer = oxNew(d3parameterContainer::class);
|
||||
$this->oParameterContainer->set('oSet', $oModCfg);
|
||||
|
||||
$this->setInstallCheckList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws d3ParameterNotFoundException
|
||||
*/
|
||||
public function setInstallCheckList()
|
||||
{
|
||||
if (is_array($this->aInstallCheckItems) && count($this->aInstallCheckItems)) {
|
||||
foreach ($this->aInstallCheckItems as $sClassName) {
|
||||
$this->offsetSet($sClassName, $this->_getCheckItemObject($sClassName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasErrors()
|
||||
{
|
||||
if ($this->count()) {
|
||||
/** @var d3InstallCheckInterface $oInstallCheckItem */
|
||||
foreach ($this->getArray() as $oInstallCheckItem) {
|
||||
if (false == $oInstallCheckItem->hasCheckPassed()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sClassName
|
||||
* @return BaseModel
|
||||
* @throws d3ParameterNotFoundException
|
||||
*/
|
||||
protected function _getCheckItemObject($sClassName)
|
||||
{
|
||||
return oxNew(
|
||||
$sClassName,
|
||||
$this->oParameterContainer->get('oSet')
|
||||
);
|
||||
}
|
||||
}
|
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installaction.php
Normal file
2
Application/Model/Installwizzard/d3installaction.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installdbcommon.php
Normal file
2
Application/Model/Installwizzard/d3installdbcommon.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installdbfield.php
Normal file
2
Application/Model/Installwizzard/d3installdbfield.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installdbindizes.php
Normal file
2
Application/Model/Installwizzard/d3installdbindizes.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installdbrecord.php
Normal file
2
Application/Model/Installwizzard/d3installdbrecord.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installdbtable.php
Normal file
2
Application/Model/Installwizzard/d3installdbtable.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installfile.php
Normal file
2
Application/Model/Installwizzard/d3installfile.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installmodcfg.php
Normal file
2
Application/Model/Installwizzard/d3installmodcfg.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installmodule.php
Normal file
2
Application/Model/Installwizzard/d3installmodule.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installoxconfig.php
Normal file
2
Application/Model/Installwizzard/d3installoxconfig.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installskipjob.php
Normal file
2
Application/Model/Installwizzard/d3installskipjob.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installskipupdate.php
Normal file
2
Application/Model/Installwizzard/d3installskipupdate.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
2
Application/Model/Installwizzard/d3installupdatefile.php
Normal file
2
Application/Model/Installwizzard/d3installupdatefile.php
Normal file
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
79
Application/Model/Log/Psr3Adapter.php
Normal file
79
Application/Model/Log/Psr3Adapter.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Log;
|
||||
|
||||
use Psr\Log\InvalidArgumentException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Psr3Adapter implements LoggerInterface
|
||||
{
|
||||
public function __construct(protected d3LogInterface $log)
|
||||
{
|
||||
}
|
||||
|
||||
public function notice($message, array $context = []): void
|
||||
{
|
||||
$this->log->notice(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function info($message, array $context = []): void
|
||||
{
|
||||
$this->log->info(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function error($message, array $context = []): void
|
||||
{
|
||||
$this->log->error(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function emergency($message, array $context = []): void
|
||||
{
|
||||
$this->log->emergency(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function warning($message, array $context = []): void
|
||||
{
|
||||
$this->log->warning(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function alert($message, array $context = []): void
|
||||
{
|
||||
$this->log->alert(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function critical($message, array $context = []): void
|
||||
{
|
||||
$this->log->critical(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function debug($message, array $context = []): void
|
||||
{
|
||||
$this->log->debug(__CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
}
|
||||
|
||||
public function log($level, $message, array $context = []): void
|
||||
{
|
||||
if (is_string($level)) {
|
||||
$level = d3LogLevel::stringToIntLevel((string) $level);
|
||||
}
|
||||
|
||||
if (is_int($level)) {
|
||||
$this->log->log($level, __CLASS__, __FUNCTION__, __LINE__, '', $message);
|
||||
} else {
|
||||
throw new InvalidArgumentException('log level must be string or integer');
|
||||
}
|
||||
}
|
||||
}
|
196
Application/Model/Log/d3LogInterface.php
Normal file
196
Application/Model/Log/d3LogInterface.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Log;
|
||||
|
||||
interface d3LogInterface
|
||||
{
|
||||
/**
|
||||
* @param string $sModId
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function setModId($sModId);
|
||||
|
||||
/**
|
||||
* @param string $sProfileId
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function setProfileId($sProfileId);
|
||||
|
||||
/**
|
||||
* @param int $iLogType1
|
||||
* @param int|null $iLogType2
|
||||
* @param int|null $iLogType3
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function setLogType($iLogType1, $iLogType2 = null, $iLogType3 = null);
|
||||
|
||||
/**
|
||||
* @param $sStatus
|
||||
* @param false $oSet
|
||||
* @return false
|
||||
*/
|
||||
public function getLogStatus($sStatus, $oSet = false);
|
||||
|
||||
/**
|
||||
* @param int $level
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function log(
|
||||
$level = d3LogLevel::EMERGENCY,
|
||||
$sClass = self::class,
|
||||
$sFnc = __FUNCTION__,
|
||||
$iLine = __LINE__,
|
||||
$sAction = null,
|
||||
$mText = null,
|
||||
$blDie = false
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function emergency($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function alert($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function critical($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function error($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function warning($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function notice($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function info($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function debug($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function test($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false);
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function addLogType($iType);
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function removeLogType($iType);
|
||||
|
||||
public function d3GetProfiling();
|
||||
|
||||
public function convertAdminLogSettings();
|
||||
}
|
117
Application/Model/Log/d3LogLevel.php
Normal file
117
Application/Model/Log/d3LogLevel.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Log;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
class d3LogLevel extends LogLevel
|
||||
{
|
||||
// single log levels
|
||||
public const EMERGENCY = 0; // 1
|
||||
public const ALERT = 1; // 2
|
||||
public const CRITICAL = 2; // 4
|
||||
public const ERROR = 3; // 8
|
||||
public const WARNING = 4; // 16
|
||||
public const NOTICE = 5; // 32
|
||||
public const INFO = 6; // 64
|
||||
public const DEBUG = 7; // 128
|
||||
public const TEST = 8; // 256
|
||||
public const LOGLEVEL_9 = 9; // 512 // not used
|
||||
public const LOGLEVEL_10 = 10; // 1024 // not used
|
||||
public const LOGLEVEL_11 = 11; // 2048 // not used
|
||||
public const NONE = 12; // 4096
|
||||
|
||||
// grouped log levels
|
||||
public const ERROR_GROUP = 0 |
|
||||
1 << self::EMERGENCY |
|
||||
1 << self::ALERT |
|
||||
1 << self::CRITICAL |
|
||||
1 << self::ERROR; // 15
|
||||
|
||||
public const WARNING_GROUP = 0 |
|
||||
1 << self::WARNING; // 16
|
||||
|
||||
public const NOTICE_GROUP = 0 |
|
||||
1 << self::NOTICE; // 32
|
||||
|
||||
public const INFO_GROUP = 0 |
|
||||
1 << self::INFO; // 64
|
||||
|
||||
public const DEV_GROUP = 0 |
|
||||
1 << self::DEBUG |
|
||||
1 << self::TEST; // 384
|
||||
|
||||
public const EMPTY_GROUP = 0 |
|
||||
1 << self::LOGLEVEL_9 |
|
||||
1 << self::LOGLEVEL_10 |
|
||||
1 << self::LOGLEVEL_11; // 3584
|
||||
|
||||
public const NONE_GROUP = 0 |
|
||||
1 << self::NONE; // 4096
|
||||
|
||||
// ranged log levels
|
||||
public const ERROR_AND_ABOVE = 0 |
|
||||
self::ERROR_GROUP; // 15
|
||||
|
||||
public const WARNING_AND_ABOVE = self::ERROR_AND_ABOVE |
|
||||
self::WARNING_GROUP; // 31
|
||||
|
||||
public const NOTICE_AND_ABOVE = self::WARNING_AND_ABOVE |
|
||||
self::NOTICE_GROUP; // 63
|
||||
|
||||
public const INFO_AND_ABOVE = self::NOTICE_AND_ABOVE |
|
||||
self::INFO_GROUP; // 127
|
||||
|
||||
public const DEV_AND_ABOVE = self::INFO_AND_ABOVE |
|
||||
self::DEV_GROUP |
|
||||
self::EMPTY_GROUP; // 4095
|
||||
|
||||
public const ALL = self::DEV_AND_ABOVE |
|
||||
self::NONE_GROUP; // 8191
|
||||
|
||||
public const ERROR_AND_BELOW = self::ALL; // 8191
|
||||
|
||||
public const WARNING_AND_BELOW = self::ERROR_AND_BELOW
|
||||
& ~self::ERROR_GROUP; // 8176
|
||||
|
||||
public const NOTICE_AND_BELOW = self::WARNING_AND_BELOW
|
||||
& ~self::WARNING_GROUP; // 8160
|
||||
|
||||
public const INFO_AND_BELOW = self::NOTICE_AND_BELOW
|
||||
& ~self::NOTICE_GROUP; // 8128
|
||||
|
||||
public const DEV_AND_BELOW = self::INFO_AND_BELOW
|
||||
& ~self::INFO_GROUP; // 8064
|
||||
|
||||
public const EMPTY_AND_BELOW = self::DEV_AND_BELOW
|
||||
& ~self::DEV_GROUP; // 7680
|
||||
|
||||
public static function stringToIntLevel(string $stringLevel): int
|
||||
{
|
||||
return match ($stringLevel) {
|
||||
LogLevel::EMERGENCY => self::EMERGENCY,
|
||||
LogLevel::ALERT => self::ALERT,
|
||||
LogLevel::CRITICAL => self::CRITICAL,
|
||||
LogLevel::ERROR => self::ERROR,
|
||||
LogLevel::WARNING => self::WARNING,
|
||||
LogLevel::NOTICE => self::NOTICE,
|
||||
LogLevel::INFO => self::INFO,
|
||||
LogLevel::DEBUG => self::DEBUG,
|
||||
default => throw new InvalidArgumentException('unknown loglevel '.$stringLevel)
|
||||
};
|
||||
}
|
||||
}
|
254
Application/Model/Log/d3NullLogger.php
Normal file
254
Application/Model/Log/d3NullLogger.php
Normal file
@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Log;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\LoggerTrait;
|
||||
|
||||
class d3NullLogger implements d3LogInterface
|
||||
{
|
||||
use LoggerTrait;
|
||||
|
||||
/**
|
||||
* @param string $sModId
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function setModId($sModId)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sProfileId
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function setProfileId($sProfileId)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iLogType1
|
||||
* @param int|null $iLogType2
|
||||
* @param int|null $iLogType3
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function setLogType($iLogType1, $iLogType2 = null, $iLogType3 = null)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sStatus
|
||||
* @param false $oSet
|
||||
* @return false
|
||||
*/
|
||||
public function getLogStatus($sStatus, $oSet = false)
|
||||
{
|
||||
unset($sStatus);
|
||||
unset($oSet);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $level
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function log(
|
||||
$level = d3LogLevel::EMERGENCY,
|
||||
$sClass = self::class,
|
||||
$sFnc = __FUNCTION__,
|
||||
$iLine = __LINE__,
|
||||
$sAction = null,
|
||||
$mText = null,
|
||||
$blDie = false
|
||||
) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function emergency($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function alert($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function critical($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function error($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function warning($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function notice($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function info($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function debug($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sFnc
|
||||
* @param int $iLine
|
||||
* @param string|null $sAction
|
||||
* @param string|null $mText
|
||||
* @param bool $blDie
|
||||
*
|
||||
* @return d3LogInterface
|
||||
*/
|
||||
public function test($sClass = self::class, $sFnc = __FUNCTION__, $iLine = __LINE__, $sAction = null, $mText = null, $blDie = false)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function addLogType($iType)
|
||||
{
|
||||
return d3LogLevel::NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iType
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function removeLogType($iType)
|
||||
{
|
||||
return d3LogLevel::NONE;
|
||||
}
|
||||
|
||||
public function d3GetProfiling()
|
||||
{
|
||||
}
|
||||
|
||||
public function convertAdminLogSettings()
|
||||
{
|
||||
}
|
||||
}
|
1666
Application/Model/Log/d3log.php
Normal file
1666
Application/Model/Log/d3log.php
Normal file
Diff onderdrukt omdat het te groot bestand
Laad Diff
115
Application/Model/Maintenance/Actions/AbstractAction.php
Normal file
115
Application/Model/Maintenance/Actions/AbstractAction.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use Assert\Assert;
|
||||
use Assert\InvalidArgumentException;
|
||||
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
|
||||
use Doctrine\DBAL\Exception as DoctrineException;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Core\UtilsView;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
abstract class AbstractAction implements ActionInterface
|
||||
{
|
||||
/**
|
||||
* @return QueryBuilder
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function getQueryBuilder(): QueryBuilder
|
||||
{
|
||||
return ContainerFactory::getInstance()->getContainer()->get(QueryBuilderFactoryInterface::class)->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QueryBuilder $baseQuery
|
||||
* @param string $oxidField
|
||||
* @param string $deleteTable
|
||||
* @param string $messageIdent
|
||||
*
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function fixAction(QueryBuilder $baseQuery, string $oxidField, string $deleteTable, string $messageIdent): void
|
||||
{
|
||||
try {
|
||||
$baseQuery->select($oxidField);
|
||||
|
||||
$allIds = $baseQuery->execute()->fetchAllAssociative();
|
||||
Assert::that($allIds)->isArray()->minCount(1);
|
||||
|
||||
$queryBuilder = $this->getQueryBuilder();
|
||||
$queryBuilder->delete($deleteTable)
|
||||
->where(
|
||||
$queryBuilder->expr()->in('oxid', implode(
|
||||
', ',
|
||||
array_map(
|
||||
fn ($fieldList) => $queryBuilder->createNamedParameter($fieldList['oxid']),
|
||||
$allIds
|
||||
)
|
||||
))
|
||||
);
|
||||
|
||||
$this->_performAction(
|
||||
[ count($allIds) ? $queryBuilder : null ],
|
||||
$messageIdent
|
||||
);
|
||||
} catch (InvalidArgumentException) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param QueryBuilder[]|null[] $aClearQueries
|
||||
* @param $sMessageIdent
|
||||
*/
|
||||
protected function _performAction(array $aClearQueries, $sMessageIdent): void
|
||||
{
|
||||
$iRow = 0;
|
||||
|
||||
/** @var ?QueryBuilder $clearQuery */
|
||||
foreach ($aClearQueries as $clearQuery) {
|
||||
try {
|
||||
$iRow += $clearQuery ? $clearQuery->execute() : 0;
|
||||
} catch (DoctrineException $e) {
|
||||
Registry::getUtilsView()->addErrorToDisplay($e);
|
||||
}
|
||||
}
|
||||
|
||||
Registry::get(UtilsView::class)->addErrorToDisplay(
|
||||
sprintf(
|
||||
Registry::getLang()->translateString($sMessageIdent),
|
||||
$iRow
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UtilsView
|
||||
*/
|
||||
protected function getUtilsView(): UtilsView
|
||||
{
|
||||
return Registry::getUtilsView();
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use D3\ModCfg\Application\Model\Maintenance\d3clrtmp;
|
||||
|
||||
abstract class AbstractClearImagesAction extends AbstractAction
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAffectedRows(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return d3clrtmp
|
||||
*/
|
||||
protected function getClrTmp(): d3clrtmp
|
||||
{
|
||||
return oxNew(d3clrtmp::class);
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
|
||||
use Doctrine\DBAL\Exception as DoctrineException;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class AccessioreToArticleOrphans extends AbstractAction
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getAffectedRows(): int
|
||||
{
|
||||
$queryBuilder = $this->getBaseQuery('a2a');
|
||||
$queryBuilder->select('count(*)')
|
||||
->setMaxResults(1);
|
||||
|
||||
return (int) $queryBuilder->execute()->fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function fixIt(): void
|
||||
{
|
||||
$this->fixAction(
|
||||
$this->getBaseQuery('a2a'),
|
||||
'a2a.oxid',
|
||||
'oxaccessoire2article',
|
||||
'D3_CFG_CLRTMP_ASSIGNACC2ART_SUCC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableAlias
|
||||
*
|
||||
* @return QueryBuilder
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function getBaseQuery(string $tableAlias): QueryBuilder
|
||||
{
|
||||
$queryBuilder = $this->getQueryBuilder();
|
||||
$queryBuilder
|
||||
->from('oxaccessoire2article', $tableAlias)
|
||||
->leftJoin(
|
||||
$tableAlias,
|
||||
'oxarticles',
|
||||
'art',
|
||||
$queryBuilder->expr()->eq($tableAlias.'.oxarticlenid', 'art.oxid')
|
||||
)
|
||||
->leftJoin(
|
||||
$tableAlias,
|
||||
'oxarticles',
|
||||
'acc',
|
||||
$queryBuilder->expr()->eq($tableAlias.'.oxobjectid', 'acc.oxid')
|
||||
)
|
||||
->where(
|
||||
$queryBuilder->expr()->or(
|
||||
$queryBuilder->expr()->isNull('art.oxid'),
|
||||
$queryBuilder->expr()->isNull('acc.oxid')
|
||||
)
|
||||
);
|
||||
return $queryBuilder;
|
||||
}
|
||||
}
|
25
Application/Model/Maintenance/Actions/ActionInterface.php
Normal file
25
Application/Model/Maintenance/Actions/ActionInterface.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
interface ActionInterface
|
||||
{
|
||||
public function getAffectedRows(): int;
|
||||
|
||||
public function fixIt(): void;
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
|
||||
use Doctrine\DBAL\Exception as DoctrineException;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class ActionsToArticleOrphans extends AbstractAction
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getAffectedRows(): int
|
||||
{
|
||||
$oQB = $this->getBaseQuery('a2a');
|
||||
$oQB->select('count(*)')
|
||||
->setMaxResults(1);
|
||||
|
||||
return (int) $oQB->execute()->fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function fixIt(): void
|
||||
{
|
||||
$this->fixAction(
|
||||
$this->getBaseQuery('a2a'),
|
||||
'a2a.oxid',
|
||||
'oxactions2article',
|
||||
'D3_CFG_CLRTMP_ASSIGNACT2ART_SUCC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableAlias
|
||||
*
|
||||
* @return QueryBuilder
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function getBaseQuery(string $tableAlias): QueryBuilder
|
||||
{
|
||||
$oQB = $this->getQueryBuilder();
|
||||
$oQB->from('oxactions2article', $tableAlias)
|
||||
->leftJoin($tableAlias, 'oxactions', 'oa', $oQB->expr()->eq($tableAlias.'.oxactionid', 'oa.oxid'))
|
||||
->leftJoin($tableAlias, 'oxarticles', 'oar', $oQB->expr()->eq($tableAlias.'.oxartid', 'oar.oxid'))
|
||||
->where(
|
||||
$oQB->expr()->or(
|
||||
$oQB->expr()->isNull('oa.oxid'),
|
||||
$oQB->expr()->isNull('oar.oxid')
|
||||
)
|
||||
);
|
||||
return $oQB;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
|
||||
use Doctrine\DBAL\Exception as DoctrineException;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class ArticleExtendsOrphans extends AbstractAction
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getAffectedRows(): int
|
||||
{
|
||||
$oQB = $this->getBaseQuery('oae');
|
||||
$oQB->select('count(*)')
|
||||
->setMaxResults(1);
|
||||
|
||||
return (int) $oQB->execute()->fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function fixIt(): void
|
||||
{
|
||||
$this->fixAction(
|
||||
$this->getBaseQuery('oae'),
|
||||
'oae.oxid',
|
||||
'oxartextends',
|
||||
'D3_CFG_CLRTMP_ASSIGNARTEXTENDS_SUCC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableAlias
|
||||
*
|
||||
* @return QueryBuilder
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function getBaseQuery(string $tableAlias): QueryBuilder
|
||||
{
|
||||
$oQB = $this->getQueryBuilder();
|
||||
$oQB->from('oxartextends', $tableAlias)
|
||||
->leftJoin($tableAlias, 'oxarticles', 'oar', $oQB->expr()->eq($tableAlias.'.oxid', 'oar.oxid'))
|
||||
->where(
|
||||
$oQB->expr()->isNull('oar.oxid')
|
||||
);
|
||||
return $oQB;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use Doctrine\DBAL\Driver\Exception as DoctrineDriverException;
|
||||
use Doctrine\DBAL\Exception as DoctrineException;
|
||||
use Doctrine\DBAL\Query\QueryBuilder;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class CategoryToAttributeOrphans extends AbstractAction
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getAffectedRows(): int
|
||||
{
|
||||
$oQB = $this->getBaseQuery('c2a');
|
||||
$oQB->select('count(*)')
|
||||
->setMaxResults(1);
|
||||
|
||||
return (int) $oQB->execute()->fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws DoctrineDriverException
|
||||
* @throws DoctrineException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function fixIt(): void
|
||||
{
|
||||
$this->fixAction(
|
||||
$this->getBaseQuery('c2a'),
|
||||
'c2a.oxid',
|
||||
'oxcategory2attribute',
|
||||
'D3_CFG_CLRTMP_ASSIGNCAT2ATTRIB_SUCC'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableAlias
|
||||
*
|
||||
* @return QueryBuilder
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function getBaseQuery(string $tableAlias): QueryBuilder
|
||||
{
|
||||
$oQB = $this->getQueryBuilder();
|
||||
$oQB->from('oxcategory2attribute', $tableAlias)
|
||||
->leftJoin($tableAlias, 'oxcategories', 'oc', $oQB->expr()->eq($tableAlias.'.oxobjectid', 'oc.oxid'))
|
||||
->leftJoin($tableAlias, 'oxattribute', 'oa', $oQB->expr()->eq($tableAlias.'.oxattrid', 'oa.oxid'))
|
||||
->where(
|
||||
$oQB->expr()->or(
|
||||
$oQB->expr()->isNull('oc.oxid'),
|
||||
$oQB->expr()->isNull('oa.oxid')
|
||||
)
|
||||
);
|
||||
return $oQB;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
*
|
||||
* 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\ModCfg\Application\Model\Maintenance\Actions;
|
||||
|
||||
use D3\ModCfg\Application\Model\Exception\d3_cfg_mod_exception;
|
||||
use D3\ModCfg\Application\Model\Exception\d3ShopCompatibilityAdapterException;
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
|
||||
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
|
||||
use OxidEsales\Eshop\Core\Exception\StandardException;
|
||||
|
||||
class ClearGeneratedArticleImages extends AbstractClearImagesAction
|
||||
{
|
||||
/**
|
||||
* @throws DatabaseConnectionException
|
||||
* @throws DatabaseErrorException
|
||||
* @throws d3ShopCompatibilityAdapterException
|
||||
* @throws d3_cfg_mod_exception
|
||||
* @throws DBALException
|
||||
* @throws StandardException
|
||||
*/
|
||||
public function fixIt(): void
|
||||
{
|
||||
$oClrTmp = $this->getClrTmp();
|
||||
$oClrTmp->clearGeneratedProductImgs();
|
||||
|
||||
$this->getUtilsView()->addErrorToDisplay('D3_CFG_CLRTMP_GENIMGS_SUCC');
|
||||
}
|
||||
}
|
Sommige bestanden werden niet getoond omdat er teveel bestanden zijn veranderd in deze diff Meer weergeven
Laden…
Verwijs in nieuw issue
Block a user