-
Notifications
You must be signed in to change notification settings - Fork 59
Fixed regression of container to set conditionally only if not present #614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AltamashShaikh I've tried to reproduce this locally and the install didn't work. I got below error:
ERROR [2023-03-30 19:35:08] 9917 test3105.local-matomo.cloud Uncaught exception in API: DI\Definition\Exception\InvalidDefinition: Entry "Piwik\Plugins\TagManager\Context\AndroidContext" cannot be resolved: Entry "Piwik\Plugins\TagManager\Context\Storage\StorageInterface" cannot be resolved: the class is not instantiable
Full definition:
Object (
class = #NOT INSTANTIABLE# Piwik\Plugins\TagManager\Context\Storage\StorageInterface
lazy = false
)
Full definition:
Object (
class = Piwik\Plugins\TagManager\Context\AndroidContext
lazy = false
__construct(
$variablesProvider = get(Piwik\Plugins\TagManager\Template\Variable\VariablesProvider)
$variableModel = get(Piwik\Plugins\TagManager\Model\Variable)
$triggerModel = get(Piwik\Plugins\TagManager\Model\Trigger)
$tagModel = get(Piwik\Plugins\TagManager\Model\Tag)
$containerModel = get(Piwik\Plugins\TagManager\Model\Container)
$storage = get(Piwik\Plugins\TagManager\Context\Storage\StorageInterface)
$salt = get(Piwik\Plugins\TagManager\Model\Salt)
)
) in /src/vendor/php-di/php-di/src/Definition/Exception/InvalidDefinition.php:19
Stack trace:
#0 /src/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(156): DI\Definition\Exception\InvalidDefinition::create(Object(DI\Definition\ObjectDefinition), 'Entry "Piwik\\Pl...')
#1 /src/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(71): DI\Definition\Resolver\ObjectCreator->createInstance(Object(DI\Definition\ObjectDefinition), Array)
#2 /src/vendor/php-di/php-di/src/Definition/Resolver/ResolverDispatcher.php(71): DI\Definition\Resolver\ObjectCreator->resolve(Object(DI\Definition\ObjectDefinition), Array)
#3 /src/vendor/php-di/php-di/src/Container.php(390): DI\Definition\Resolver\ResolverDispatcher->resolve(Object(DI\Definition\ObjectDefinition), Array)
#4 /src/vendor/php-di/php-di/src/Container.php(139): DI\Container->resolveDefinition(Object(DI\Definition\ObjectDefinition))
#5 /src/core/Container/StaticContainer.php(81): DI\Container->get('Piwik\\Plugins\\T...')
#6 /src/plugins/TagManager/Context/ContextProvider.php(61): Piwik\Container\StaticContainer::get('Piwik\\Plugins\\T...')
#7 /src/plugins/TagManager/Context/ContextProvider.php(44): Piwik\Plugins\TagManager\Context\ContextProvider->getAllContexts()
#8 /src/plugins/TagManager/Context/ContextProvider.php(33): Piwik\Plugins\TagManager\Context\ContextProvider->getContext('web')
#9 /src/plugins/TagManager/Model/Container.php(158): Piwik\Plugins\TagManager\Context\ContextProvider->checkIsValidContext('web')
#10 /src/plugins/TagManager/API.php(988): Piwik\Plugins\TagManager\Model\Container->addContainer('1', 'web', 'Default Contain...', 'This container ...')
#11 [internal function]: Piwik\Plugins\TagManager\API->addContainer('1', 'web', 'Default Contain...', 'This container ...')
#12 /src/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#13 /src/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#14 /src/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#15 /src/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'addContainer', Array)
#16 /src/core/API/Request.php(560): Piwik\API\Request->process()
#17 /src/plugins/TagManager/API.php(401): Piwik\API\Request::processRequest('TagManager.addC...', Array, Array)
#18 [internal function]: Piwik\Plugins\TagManager\API->createDefaultContainerForSite('1')
#19 /src/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#20 /src/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#21 /src/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#22 /src/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'createDefaultCo...', Array)
#23 /src/core/API/Request.php(560): Piwik\API\Request->process()
#24 /src/plugins/TagManager/TagManager.php(241): Piwik\API\Request::processRequest('TagManager.crea...', Array, Array)
#25 [internal function]: Piwik\Plugins\TagManager\TagManager->onPluginActivated('TagManager')
#26 /src/core/EventDispatcher.php(147): call_user_func_array(Array, Array)
#27 /src/core/Piwik.php(871): Piwik\EventDispatcher->postEvent('PluginManager.p...', Array, false, Array)
#28 /src/core/Plugin/Manager.php(712): Piwik\Piwik::postEvent('PluginManager.p...', Array)
#29 /src/plugins/CorePluginsAdmin/Commands/ActivatePlugin.php(51): Piwik\Plugin\Manager->activatePlugin('TagManager')
#30 /src/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CorePluginsAdmin\Commands\ActivatePlugin->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CorePluginsAdmin\Commands\ActivatePlugin), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /src/core/Console.php(108): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 [internal function]: Piwik\Console->originDoRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /src/core/Console.php(147): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 /src/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#37 /src/core/Console.php(148): Piwik\Access::doAsSuperUser(Object(Closure))
#38 /src/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /src/console(32): Symfony\Component\Console\Application->run()
#41 {main}
ERROR [2023-03-30 19:35:08] 9917 test3105.local-matomo.cloud Uncaught exception in API: DI\Definition\Exception\InvalidDefinition: Entry "Piwik\Plugins\TagManager\Context\AndroidContext" cannot be resolved: Entry "Piwik\Plugins\TagManager\Context\Storage\StorageInterface" cannot be resolved: the class is not instantiable
Full definition:
Object (
class = #NOT INSTANTIABLE# Piwik\Plugins\TagManager\Context\Storage\StorageInterface
lazy = false
)
Full definition:
Object (
class = Piwik\Plugins\TagManager\Context\AndroidContext
lazy = false
__construct(
$variablesProvider = get(Piwik\Plugins\TagManager\Template\Variable\VariablesProvider)
$variableModel = get(Piwik\Plugins\TagManager\Model\Variable)
$triggerModel = get(Piwik\Plugins\TagManager\Model\Trigger)
$tagModel = get(Piwik\Plugins\TagManager\Model\Tag)
$containerModel = get(Piwik\Plugins\TagManager\Model\Container)
$storage = get(Piwik\Plugins\TagManager\Context\Storage\StorageInterface)
$salt = get(Piwik\Plugins\TagManager\Model\Salt)
)
) in /src/vendor/php-di/php-di/src/Definition/Exception/InvalidDefinition.php:19
Stack trace:
#0 /src/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(156): DI\Definition\Exception\InvalidDefinition::create(Object(DI\Definition\ObjectDefinition), 'Entry "Piwik\\Pl...')
#1 /src/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(71): DI\Definition\Resolver\ObjectCreator->createInstance(Object(DI\Definition\ObjectDefinition), Array)
#2 /src/vendor/php-di/php-di/src/Definition/Resolver/ResolverDispatcher.php(71): DI\Definition\Resolver\ObjectCreator->resolve(Object(DI\Definition\ObjectDefinition), Array)
#3 /src/vendor/php-di/php-di/src/Container.php(390): DI\Definition\Resolver\ResolverDispatcher->resolve(Object(DI\Definition\ObjectDefinition), Array)
#4 /src/vendor/php-di/php-di/src/Container.php(139): DI\Container->resolveDefinition(Object(DI\Definition\ObjectDefinition))
#5 /src/core/Container/StaticContainer.php(81): DI\Container->get('Piwik\\Plugins\\T...')
#6 /src/plugins/TagManager/Context/ContextProvider.php(61): Piwik\Container\StaticContainer::get('Piwik\\Plugins\\T...')
#7 /src/plugins/TagManager/Context/ContextProvider.php(44): Piwik\Plugins\TagManager\Context\ContextProvider->getAllContexts()
#8 /src/plugins/TagManager/Context/ContextProvider.php(33): Piwik\Plugins\TagManager\Context\ContextProvider->getContext('web')
#9 /src/plugins/TagManager/Model/Container.php(158): Piwik\Plugins\TagManager\Context\ContextProvider->checkIsValidContext('web')
#10 /src/plugins/TagManager/API.php(988): Piwik\Plugins\TagManager\Model\Container->addContainer('1', 'web', 'Default Contain...', 'This container ...')
#11 [internal function]: Piwik\Plugins\TagManager\API->addContainer('1', 'web', 'Default Contain...', 'This container ...')
#12 /src/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#13 /src/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#14 /src/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#15 /src/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'addContainer', Array)
#16 /src/core/API/Request.php(560): Piwik\API\Request->process()
#17 /src/plugins/TagManager/API.php(401): Piwik\API\Request::processRequest('TagManager.addC...', Array, Array)
#18 [internal function]: Piwik\Plugins\TagManager\API->createDefaultContainerForSite('1')
#19 /src/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#20 /src/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#21 /src/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#22 /src/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'createDefaultCo...', Array)
#23 /src/core/API/Request.php(560): Piwik\API\Request->process()
#24 /src/plugins/TagManager/TagManager.php(241): Piwik\API\Request::processRequest('TagManager.crea...', Array, Array)
#25 [internal function]: Piwik\Plugins\TagManager\TagManager->onPluginActivated('TagManager')
#26 /src/core/EventDispatcher.php(147): call_user_func_array(Array, Array)
#27 /src/core/Piwik.php(871): Piwik\EventDispatcher->postEvent('PluginManager.p...', Array, false, Array)
#28 /src/core/Plugin/Manager.php(712): Piwik\Piwik::postEvent('PluginManager.p...', Array)
#29 /src/plugins/CorePluginsAdmin/Commands/ActivatePlugin.php(51): Piwik\Plugin\Manager->activatePlugin('TagManager')
#30 /src/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CorePluginsAdmin\Commands\ActivatePlugin->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CorePluginsAdmin\Commands\ActivatePlugin), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /src/core/Console.php(108): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 [internal function]: Piwik\Console->originDoRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /src/core/Console.php(147): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 /src/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#37 /src/core/Console.php(148): Piwik\Access::doAsSuperUser(Object(Closure))
#38 /src/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /src/console(32): Symfony\Component\Console\Application->run()
#41 {main}
ERROR [2023-03-30 19:35:08] 9917 test3105.local-matomo.cloud Uncaught exception: DI\Definition\Exception\InvalidDefinition: Entry "Piwik\Plugins\TagManager\Context\AndroidContext" cannot be resolved: Entry "Piwik\Plugins\TagManager\Context\Storage\StorageInterface" cannot be resolved: the class is not instantiable
Full definition:
Object (
class = #NOT INSTANTIABLE# Piwik\Plugins\TagManager\Context\Storage\StorageInterface
lazy = false
)
Full definition:
Object (
class = Piwik\Plugins\TagManager\Context\AndroidContext
lazy = false
__construct(
$variablesProvider = get(Piwik\Plugins\TagManager\Template\Variable\VariablesProvider)
$variableModel = get(Piwik\Plugins\TagManager\Model\Variable)
$triggerModel = get(Piwik\Plugins\TagManager\Model\Trigger)
$tagModel = get(Piwik\Plugins\TagManager\Model\Tag)
$containerModel = get(Piwik\Plugins\TagManager\Model\Container)
$storage = get(Piwik\Plugins\TagManager\Context\Storage\StorageInterface)
$salt = get(Piwik\Plugins\TagManager\Model\Salt)
)
) in /src/vendor/php-di/php-di/src/Definition/Exception/InvalidDefinition.php:19
Stack trace:
#0 /src/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(156): DI\Definition\Exception\InvalidDefinition::create(Object(DI\Definition\ObjectDefinition), 'Entry "Piwik\\Pl...')
#1 /src/vendor/php-di/php-di/src/Definition/Resolver/ObjectCreator.php(71): DI\Definition\Resolver\ObjectCreator->createInstance(Object(DI\Definition\ObjectDefinition), Array)
#2 /src/vendor/php-di/php-di/src/Definition/Resolver/ResolverDispatcher.php(71): DI\Definition\Resolver\ObjectCreator->resolve(Object(DI\Definition\ObjectDefinition), Array)
#3 /src/vendor/php-di/php-di/src/Container.php(390): DI\Definition\Resolver\ResolverDispatcher->resolve(Object(DI\Definition\ObjectDefinition), Array)
#4 /src/vendor/php-di/php-di/src/Container.php(139): DI\Container->resolveDefinition(Object(DI\Definition\ObjectDefinition))
#5 /src/core/Container/StaticContainer.php(81): DI\Container->get('Piwik\\Plugins\\T...')
#6 /src/plugins/TagManager/Context/ContextProvider.php(61): Piwik\Container\StaticContainer::get('Piwik\\Plugins\\T...')
#7 /src/plugins/TagManager/Context/ContextProvider.php(44): Piwik\Plugins\TagManager\Context\ContextProvider->getAllContexts()
#8 /src/plugins/TagManager/Context/ContextProvider.php(33): Piwik\Plugins\TagManager\Context\ContextProvider->getContext('web')
#9 /src/plugins/TagManager/Model/Container.php(158): Piwik\Plugins\TagManager\Context\ContextProvider->checkIsValidContext('web')
#10 /src/plugins/TagManager/API.php(988): Piwik\Plugins\TagManager\Model\Container->addContainer('1', 'web', 'Default Contain...', 'This container ...')
#11 [internal function]: Piwik\Plugins\TagManager\API->addContainer('1', 'web', 'Default Contain...', 'This container ...')
#12 /src/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#13 /src/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#14 /src/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#15 /src/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'addContainer', Array)
#16 /src/core/API/Request.php(560): Piwik\API\Request->process()
#17 /src/plugins/TagManager/API.php(401): Piwik\API\Request::processRequest('TagManager.addC...', Array, Array)
#18 [internal function]: Piwik\Plugins\TagManager\API->createDefaultContainerForSite('1')
#19 /src/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#20 /src/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#21 /src/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#22 /src/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'createDefaultCo...', Array)
#23 /src/core/API/Request.php(560): Piwik\API\Request->process()
#24 /src/plugins/TagManager/TagManager.php(241): Piwik\API\Request::processRequest('TagManager.crea...', Array, Array)
#25 [internal function]: Piwik\Plugins\TagManager\TagManager->onPluginActivated('TagManager')
#26 /src/core/EventDispatcher.php(147): call_user_func_array(Array, Array)
#27 /src/core/Piwik.php(871): Piwik\EventDispatcher->postEvent('PluginManager.p...', Array, false, Array)
#28 /src/core/Plugin/Manager.php(712): Piwik\Piwik::postEvent('PluginManager.p...', Array)
#29 /src/plugins/CorePluginsAdmin/Commands/ActivatePlugin.php(51): Piwik\Plugin\Manager->activatePlugin('TagManager')
#30 /src/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CorePluginsAdmin\Commands\ActivatePlugin->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CorePluginsAdmin\Commands\ActivatePlugin), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /src/core/Console.php(108): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 [internal function]: Piwik\Console->originDoRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /src/core/Console.php(147): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 /src/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#37 /src/core/Console.php(148): Piwik\Access::doAsSuperUser(Object(Closure))
#38 /src/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /src/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /src/console(32): Symfony\Component\Console\Application->run()
#41 {main}
[DI\Definition\Exception\InvalidDefinition]
Entry "Piwik\Plugins\TagManager\Context\AndroidContext" cannot be resolved: Entry "Piwik\Plugins\TagManager\Context\Storage\StorageInterface" cannot be resolved: the class is not instantiable
Full definition:
Object (
class = #NOT INSTANTIABLE# Piwik\Plugins\TagManager\Context\Storage\StorageInterface
lazy = false
)
Full definition:
Object (
class = Piwik\Plugins\TagManager\Context\AndroidContext
lazy = false
__construct(
$variablesProvider = get(Piwik\Plugins\TagManager\Template\Variable\VariablesProvider)
$variableModel = get(Piwik\Plugins\TagManager\Model\Variable)
$triggerModel = get(Piwik\Plugins\TagManager\Model\Trigger)
$tagModel = get(Piwik\Plugins\TagManager\Model\Tag)
$containerModel = get(Piwik\Plugins\TagManager\Model\Container)
$storage = get(Piwik\Plugins\TagManager\Context\Storage\StorageInterface)
$salt = get(Piwik\Plugins\TagManager\Model\Salt)
)
)
TagManager.php
Outdated
StaticContainer::getContainer()->set('TagManagerContainerStorageDir', '/js'); | ||
StaticContainer::getContainer()->set('TagManagerContainerFilesPrefix', 'container_'); | ||
StaticContainer::getContainer()->set('TagManagerJSMinificationEnabled', true); | ||
if (!StaticContainer::getContainer()->has('Piwik\Plugins\TagManager\Model\Container\ContainerIdGenerator')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi not sure if it makes sense, but to avoid this becoming eventually different in config.php, we could potentially do something like. might be worth a try. In any case we'd otherwise need a comment in config.php that this logic needs to be updated every time an entry is added or changed etc.
$configPhp = include 'config/config.php';
foreach ($configPhp as $key => $val)
{
if (!container has) {
container set
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tsteur I tried with this code and it worked for on premise but not for cloud
$configPhp = include 'config/config.php';
foreach ($configPhp as $key => $val) {
if (!StaticContainer::getContainer()->has($key)) {
StaticContainer::getContainer()->set($key, $val);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This worked
$dir = Plugin\Manager::getPluginDirectory('TagManager');
$configPhp = include $dir . '/config/config.php';
foreach ($configPhp as $key => $val) {
if (!StaticContainer::getContainer()->has($key)) {
StaticContainer::getContainer()->set($key, $val);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. I tried to test in my local cloud environment, but received a DI definition error that doesn't appear to be related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AltamashShaikh not sure why but I'm still getting the same error.
How can I replicate this behaviour ? |
@AltamashShaikh this is how I can reproduce it using the same command. Note: You need to make sure to have no container already there and a site with ID 1. Or you could delete all containers or disable that check. I can also send through chat a link to the config.php that we are using in case this helps reproducing it. |
@tsteur deleting the container and running the same command I was able to reproduce it, to resolve the error had to set explicitly |
@AltamashShaikh as mentioned in Slack that can cause issues where we change the storage. |
@tsteur wrapped with a try/catch block as discussed on Slack, please check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AltamashShaikh I just tested it and it worked. We'd just need to make sure to have a test for this method to ensure it keeps working as otherwise if there was ever any kind of exception we wouldn't realise it started breaking. I didn't check if we have a test already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. The error went away on my local cloud and it didn't create the default container. I confirmed that the default container is still created for on-premise.
|
Yes that should do 👍 |
Description:
Fixed regression of container to set conditionally only if not present.
Review