Hi Stefan,
only a guess by having a quick look at the code you showed:

config->setShopId is not a good idea. It will not reload the config object
for current the process. So you will have a mix config objects and
configuration values from different shops.

I know that oxid console is using something like "shopspecificconfig" class
to ensure loading the correct config for a given shop id but even with that
you need often to call setConfig on different objects and the registry.

I would suggest to debug and check the config objects to ensure you have
the correct config loaded.

best regards

K1




Am 06.02.2018 13:22 schrieb "Stefan Moises" <moi...@shoptimax.de>:

Hi there,

in OXID EE 5.3.x we were using a util class to activate modules based on
whitelist/blacklist for multiple subshops.

For OXID 6, that is not working 100% anymore, if a module defines its own
"controllers" in metadata.php, e.g. https://github.com/
OXIDprojects/oxid-module-internals
'controllers' => [
'module_internals_metadata' => \OxidCommunity\ModuleInternals\Controller\
Admin\Metadata::class,
'module_internals_state' => \OxidCommunity\ModuleInternals\Controller\Admin\
State::class,
'module_internals_utils' => \OxidCommunity\ModuleInternals\Controller\Admin\
Utils::class,
],

Now if I use this class

https://github.com/shoptimax/ioly_installer/blob/master/
IolyInstallerCore.php#L450

and ModuleInstaller::activate($oModule):

*        foreach ($aShopIds as $shopId) {*
*            try {*
*                $oConfig->setShopId($shopId);*
*                $oModule = oxNew('oxModule');*
*                if ($oModule->load($sModuleId)) {*
*                    $oModuleCache = oxNew('oxModuleCache', $oModule);*
*                    $oModuleInstaller = oxNew('oxModuleInstaller',
$oModuleCache);*
*                    if ($oModuleInstaller->activate($oModule)) {*
                    ...

to activate the module for multiple subshops, I get an *exception* after
the first subshop, e.g.

*Loaded moduleinternals module, trying to activate ...*
*Error activating module 'moduleinternals': Fehler: Modul nicht
aktiviert.<br />In einem Shop oder Sub-Shop müssen Schüssel und Werte für
"controllers" eindeutig sein.<br />Folgende Schlüssel oder Werte für
"controllers", die in der Datei metadata.php dieses Moduls definiert sind,
existieren schon im Shop:<br />
OxidCommunity\ModuleInternals\Controller\Admin\Metadata,OxidCommunity\ModuleInternals\Controller\Admin\State,OxidCommunity\ModuleInternals\Controller\Admin\Utils*
*#0 /var/www/html/demo-oxid6/source/oxfunctions.php(103):
OxidEsales\EshopCommunity\Core\UtilsObject->oxNew('OxidEsales\\Esho...')*
*#1
/var/www/html/demo-oxid6/vendor/oxid-esales/oxideshop-ce/source/Core/Module/ModuleInstaller.php(100):
oxNew('OxidEsales\\Esho...')*
*#2
/var/www/html/demo-oxid6/vendor/ioly/installer/IolyInstallerCore.php(450):
OxidEsales\EshopCommunity\Core\Module\ModuleInstaller->activate(Object(OxidCommunity\ModuleInternals\Core\Module))*
*#3
/var/www/html/demo-oxid6/vendor/ioly/installer/IolyInstallerCore.php(417):
ioly\IolyInstallerCore::activateModule('moduleinternals', '1')*
*#4
/var/www/html/demo-oxid6/vendor/ioly/installer/IolyInstallerCore.php(184):
ioly\IolyInstallerCore::activateModulesWhitelisted()*
*#5 /var/www/html/demo-oxid6/source/install.php(27):
ioly\IolyInstallerCore::run('/var/www/html/g...', false, false, false)*
*#6 {main}*

So it seems to work for the first subshop, but then the check for
"duplicate" controllers throws an Exception.

Any idea how to fix this? It seems that the ModuleInstaller isn't aware of
the different subshop ... I've also tried to set the Config with e.g.

$oModuleInstaller->setConfig($oConfig);

etc., but that didn't help either.

Thanks,

Stefan


-- 
--
************************************
Stefan Moises
Manager Research & Development
shoptimax GmbHUlmenstraße 52 H
90443 Nürnberg 
<https://maps.google.com/?q=Ulmenstra%C3%9Fe+52+H+90443+N%C3%BCrnberg&entry=gmail&source=g>
Tel.: 0911/25566-0
Fax: 0911/25566-29moises@shoptimax.dehttp://www.shoptimax.de

Geschäftsführung: Friedrich Schreieck
Ust.-IdNr.: DE 814340642
Amtsgericht Nürnberg HRB 21703

************************************

Reply via email to