34 $this->_oModuleCache = $oModuleCache;
58 $sModuleId = $oModule->
getId();
96 $sModuleId = $oModule->
getId();
99 $sModuleId = $oModule->
getId();
100 $this->
_callEvent(
'onDeactivate', $sModuleId);
129 return $this->
getConfig()->getModulesWithExtendedClass();
142 if (is_array($aModuleArray)) {
143 foreach ($aModuleArray as $sClass => $aModuleChain) {
144 $aModules[$sClass] = implode(
'&', $aModuleChain);
162 if (is_array($aAllModuleArray) && is_array($aRemModuleArray)) {
163 foreach ($aAllModuleArray as $sClass => $aModuleChain) {
164 if (!is_array($aModuleChain)) {
165 $aModuleChain = array($aModuleChain);
167 if (isset($aRemModuleArray[$sClass])) {
168 if (!is_array($aRemModuleArray[$sClass])) {
169 $aRemModuleArray[$sClass] = array($aRemModuleArray[$sClass]);
171 $aAllModuleArray[$sClass] = array();
172 foreach ($aModuleChain as $sModule) {
173 if (!in_array($sModule, $aRemModuleArray[$sClass])) {
174 $aAllModuleArray[$sClass][] = $sModule;
177 if (!count($aAllModuleArray[$sClass])) {
178 unset ($aAllModuleArray[$sClass]);
181 $aAllModuleArray[$sClass] = $aModuleChain;
187 return $aAllModuleArray;
197 $aDisabledModules = (array) $this->
getConfig()->getConfigParam(
'aDisabledModules');
199 $aModules = array_merge($aDisabledModules, array($sModuleId));
200 $aModules = array_unique($aModules);
212 $aExt = $this->
getConfig()->getModulesWithExtendedClass();
217 $this->
getConfig()->saveShopConfVar(
'aarr',
'aModules', $aUpdatedExt);
228 $sShopId = $this->
getConfig()->getShopId();
229 $oDb->execute(
"DELETE FROM `oxtplblocks` WHERE `oxmodule` =" . $oDb->quote($sModuleId) .
" AND `oxshopid` = " . $oDb->quote($sShopId));
239 $aTemplates = (array) $this->
getConfig()->getConfigParam(
'aModuleTemplates');
240 unset($aTemplates[$sModuleId]);
252 $aFiles = (array) $this->
getConfig()->getConfigParam(
'aModuleFiles');
253 unset($aFiles[$sModuleId]);
265 $aEvents = (array) $this->
getConfig()->getConfigParam(
'aModuleEvents');
266 unset($aEvents[$sModuleId]);
278 $aVersions = (array) $this->
getConfig()->getConfigParam(
'aModuleVersions');
279 unset($aVersions[$sModuleId]);
314 if (is_array($aAllModuleArray) && is_array($aAddModuleArray)) {
315 foreach ($aAddModuleArray as $sClass => $aModuleChain) {
316 if (!is_array($aModuleChain)) {
317 $aModuleChain = array($aModuleChain);
319 if (isset($aAllModuleArray[$sClass])) {
320 foreach ($aModuleChain as $sModule) {
321 if (!in_array($sModule, $aAllModuleArray[$sClass])) {
322 $aAllModuleArray[$sClass][] = $sModule;
326 $aAllModuleArray[$sClass] = $aModuleChain;
331 return $aAllModuleArray;
341 $aDisabledModules = (array) $this->
getConfig()->getConfigParam(
'aDisabledModules');
343 if (isset($aDisabledModules) && is_array($aDisabledModules)) {
344 $aDisabledModules = array_diff($aDisabledModules, array($sModuleId));
345 $this->
_saveToConfig(
'aDisabledModules', $aDisabledModules,
'arr');
357 $sShopId = $this->
getConfig()->getShopId();
360 if (is_array($aModuleBlocks)) {
362 foreach ($aModuleBlocks as $aValue) {
365 $sTemplate = $aValue[
"template"];
366 $iPosition = $aValue[
"position"] ? $aValue[
"position"] : 1;
367 $sBlock = $aValue[
"block"];
368 $sFile = $aValue[
"file"];
370 $sSql =
"INSERT INTO `oxtplblocks` (`OXID`, `OXACTIVE`, `OXSHOPID`, `OXTEMPLATE`, `OXBLOCKNAME`, `OXPOS`, `OXFILE`, `OXMODULE`)
371 VALUES ('{$sOxId}', 1, '{$sShopId}', " . $oDb->quote($sTemplate) .
", " . $oDb->quote($sBlock) .
", " . $oDb->quote($iPosition) .
", " . $oDb->quote($sFile) .
", '{$sModuleId}')";
373 $oDb->execute($sSql);
386 $aFiles = (array) $this->
getConfig()->getConfigParam(
'aModuleFiles');
388 if (is_array($aModuleFiles)) {
389 $aFiles[$sModuleId] = array_change_key_case($aModuleFiles, CASE_LOWER);
403 $aTemplates = (array) $this->
getConfig()->getConfigParam(
'aModuleTemplates');
404 if (is_array($aModuleTemplates)) {
405 $aTemplates[$sModuleId] = $aModuleTemplates;
421 $sShopId = $oConfig->getShopId();
424 if (is_array($aModuleSettings)) {
426 foreach ($aModuleSettings as $aValue) {
429 $sModule =
'module:' . $sModuleId;
430 $sName = $aValue[
"name"];
431 $sType = $aValue[
"type"];
432 $sValue = is_null($oConfig->getConfigParam($sName)) ? $aValue[
"value"] : $oConfig->getConfigParam($sName);
433 $sGroup = $aValue[
"group"];
436 if ($aValue[
"constraints"]) {
437 $sConstraints = $aValue[
"constraints"];
438 } elseif ($aValue[
"constrains"]) {
439 $sConstraints = $aValue[
"constrains"];
442 $iPosition = $aValue[
"position"] ? $aValue[
"position"] : 1;
444 $oConfig->setConfigParam($sName, $sValue);
445 $oConfig->saveShopConfVar($sType, $sName, $sValue, $sShopId, $sModule);
447 $sDeleteSql =
"DELETE FROM `oxconfigdisplay` WHERE OXCFGMODULE=" . $oDb->quote($sModule) .
" AND OXCFGVARNAME=" . $oDb->quote($sName);
448 $sInsertSql =
"INSERT INTO `oxconfigdisplay` (`OXID`, `OXCFGMODULE`, `OXCFGVARNAME`, `OXGROUPING`, `OXVARCONSTRAINT`, `OXPOS`) " .
449 "VALUES ('{$sOxId}', " . $oDb->quote($sModule) .
", " . $oDb->quote($sName) .
", " . $oDb->quote($sGroup) .
", " . $oDb->quote($sConstraints) .
", " . $oDb->quote($iPosition) .
")";
451 $oDb->execute($sDeleteSql);
452 $oDb->execute($sInsertSql);
465 $aEvents = (array) $this->
getConfig()->getConfigParam(
'aModuleEvents');
466 if (is_array($aEvents)) {
467 $aEvents[$sModuleId] = $aModuleEvents;
481 $aVersions = (array) $this->
getConfig()->getConfigParam(
'aModuleVersions');
482 if (is_array($aVersions)) {
483 $aVersions[$sModuleId] = $sModuleVersion;
497 $aModuleEvents = (array) $this->
getConfig()->getConfigParam(
'aModuleEvents');
499 if (isset($aModuleEvents[$sModuleId], $aModuleEvents[$sModuleId][$sEvent])) {
500 $mEvent = $aModuleEvents[$sModuleId][$sEvent];
502 if (is_callable($mEvent)) {
503 call_user_func($mEvent);
523 if (count($aInstalledModuleExtensions)) {
526 if (count($aGarbage)) {
527 $aInstalledExtensions = $this->
_removeGarbage($aInstalledExtensions, $aGarbage);
531 return $aInstalledExtensions;
544 $aGarbage = $aModuleInstalledExtensions;
546 foreach ($aModuleMetaDataExtensions as $sClassName => $sClassPath) {
547 if (isset($aGarbage[$sClassName])) {
548 unset($aGarbage[$sClassName][array_search($sClassPath, $aGarbage[$sClassName])]);
549 if (count($aGarbage[$sClassName]) == 0) {
550 unset($aGarbage[$sClassName]);
568 foreach ($aGarbage as $sClassName => $aClassPaths) {
569 foreach ($aClassPaths as $sClassPath) {
570 if (isset($aInstalledExtensions[$sClassName])) {
571 unset($aInstalledExtensions[$sClassName][array_search($sClassPath, $aInstalledExtensions[$sClassName])]);
572 if (count($aInstalledExtensions[$sClassName]) == 0) {
573 unset($aInstalledExtensions[$sClassName]);
579 return $aInstalledExtensions;
593 $aConfigsToRemove = array_diff($aModuleConfigs, $aModuleSettings);
594 if (!empty($aConfigsToRemove)) {
609 $sQuotedShopId = $oDb->quote($this->
getConfig()->getShopId());
610 $sQuotedModuleId = $oDb->quote(
'module:' . $sModuleId);
612 $sModuleConfigsQuery =
"SELECT oxvarname FROM oxconfig WHERE oxmodule = $sQuotedModuleId AND oxshopid = $sQuotedShopId";
614 return $oDb->getCol($sModuleConfigsQuery);
626 $aSettings = array();
628 if (is_array($aModuleSettings)) {
629 foreach ($aModuleSettings as $aSetting) {
630 $aSettings[] = $aSetting[
'name'];
646 $sQuotedShopId = $oDb->quote($this->
getConfig()->getShopId());
647 $sQuotedModuleId = $oDb->quote(
'module:' . $sModuleId);
649 $aQuotedConfigsToRemove = array_map(array($oDb,
'quote'), $aConfigsToRemove);
650 $sDeleteSql =
"DELETE
652 WHERE oxmodule = $sQuotedModuleId AND
653 oxshopid = $sQuotedShopId AND
654 oxvarname IN (" . implode(
", ", $aQuotedConfigsToRemove) .
")";
656 $oDb->execute($sDeleteSql);
669 $aFilteredModules = array();
670 foreach ($aModules as $sClass => $aExtend) {
671 foreach ($aExtend as $sExtendPath) {
672 if (strpos($sExtendPath, $sModuleId .
"/") === 0) {
673 $aFilteredModules[$sClass][] = $sExtendPath;
678 return $aFilteredModules;
688 protected function _saveToConfig($sVariableName, $sVariableValue, $sVariableType =
'aarr')
691 $oConfig->setConfigParam($sVariableName, $sVariableValue);
692 $oConfig->saveShopConfVar($sVariableType, $sVariableName, $sVariableValue);