After uninstalling modules using Composer and removing all trace of them, Magento is still looking for them via ModuleList\Loader->getModuleConfigs()

magento.stackexchange https://magento.stackexchange.com/questions/331073

  •  15-04-2021
  •  | 
  •  

Question

I'm trying to remove some modules (all Amasty modules) from my site for debugging purposes, but no matter what I do, Magento keeps looking for the Amasty_Base module and I can't get rid of it.

The modules were initially installed via Composer. So first I removed the modules from composer.json and ran composer update which duly removed them. Then I ran bin/magento setup:upgrade and cleared all caches as usual.

I also removed all mention of the modules from the core_config_data and setup_module database tables, and for good measure I deleted all the usual Magento cache and generated code directories and cleared Redis cache.

However, when loading my site I get the following exception which shows that Magento is still looking for a amasty/base/etc/module.xml file:

Exception #0 (Magento\Framework\Exception\FileSystemException): The contents from the "/var/www/vhosts/example.com/httpdocs/vendor/amasty/base/etc/module.xml" file can't be read. Warning!file_get_contents(/var/www/vhosts/example.com/httpdocs/vendor/amasty/base/etc/module.xml): failed to open stream: No such file or directory
<pre>#1 Magento\Framework\Filesystem\Driver\File\Interceptor->fileGetContents('/var/www/vhosts/...') called at [vendor/magento/framework/Module/ModuleList/Loader.php:120]
#2 Magento\Framework\Module\ModuleList\Loader->getModuleConfigs() called at [vendor/magento/framework/Module/ModuleList/Loader.php:81]
#3 Magento\Framework\Module\ModuleList\Loader->load() called at [vendor/magento/framework/Module/ModuleList.php:72]
#4 Magento\Framework\Module\ModuleList->getAll() called at [vendor/magento/framework/Module/ModuleList.php:92]
#5 Magento\Framework\Module\ModuleList->getOne('CoolPartner_Integrat...') called at [vendor/CoolPartner/magento2-integration/src/Integration/Helper/Data.php:36]
#6 CoolPartner\Integration\Helper\Data->getExtensionVersion() called at [vendor/CoolPartner/magento2-integration/src/Integration/Model/SDKInitializer.php:96]
#7 CoolPartner\Integration\Model\SDKInitializer->execute() called at [vendor/CoolPartner/magento2-integration/src/Integration/Plugin/AppFrontControllerPlugin.php:42]
#8 CoolPartner\Integration\Plugin\AppFrontControllerPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#000000005404ea3200000000756a40ab#, &Closure#000000005404ea2d00000000756a40ab#, &Magento\Framework\App\Request\Http#000000005404e62700000000756a40ab#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#9 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#000000005404e62700000000756a40ab#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#10 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#000000005404e62700000000756a40ab#), array(array('storeCookieValid...', 'install', 'configHash'), 'requestPreproces...')) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#11 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#000000005404e62700000000756a40ab#) called at [vendor/magento/framework/App/Http.php:136]
#12 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24]
#13 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:258]
#14 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#000000005404edf400000000756a40ab#) called at [index.php:39]
</pre>

I grepped through the code base looking for anything remotely mentioning Amasty or Amasty_Base but I can't find anything.

I've made sure all caches are off and cleared, and all pre-compiled code is gone etc.

Curiously, I even edited Magento\Framework\Component\ComponentRegistrar and added an exit statement in the register function, but nothing seemed to reach that point in the code.

What have I missed? Am I misunderstanding Magento somehow?

Was it helpful?

Solution

This turned out to be caused (at least in part) by Zend OpCache; a type of PHP code cache which had been set up on the server. It was solved by restarting the httpd and php-fpm services, and then configuring Zend OpCache to revalidate PHP files based on timestamps (which can be disabled when running sites in production mode, as long as care is taken to flush the opcache or restart web server as above).

In /etc/php-fpm.d/example.com.conf add something like:

php_value[opcache.validate_timestamps] = 1
php_value[opcache.revalidate_freq] = 0

Then restart httpd and php-fpm.

OTHER TIPS

It is happening for me on php7.4 and server is apache2. My module is completely removed but I'm getting same error as above. Please advise how can I fix it. Thanks a million!!

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top