contao / manager-bundle

[READ-ONLY] Contao Manager Bundle
GNU Lesser General Public License v3.0
17 stars 10 forks source link

fatal error during cache:clear when manually uninstalling an extension #42

Closed ghost closed 7 years ago

ghost commented 7 years ago

Issue by @fritzmg July 18th, 2017, 13:32 GMT

Tested with the contao/managed-edition 4.4.1.

Reproduction

  1. Manually install a Contao 3 extension that is compatible with Contao 4 by copying the extension folder to /system/modules.
  2. Clear the cache.
  3. Run the Install Tool.
  4. Delete the extension folder from /system/modules again to uninstall the extension.
  5. Run vendor/bin/contao-console cache:warmup or … cache:clear --no-warmup or … cache:clear. The following fatal error will occur:
    PHP Fatal error:  Uncaught LogicException: The module folder "system/modules/news_sorted" does not exist. in …\vendor\contao\core-bundle\src\HttpKernel\Bundle\ContaoModuleBundle.php:36
    Stack trace:
    #0 …\vendor\contao\manager-plugin\src\Bundle\Config\ModuleConfig.php(53): Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle->__construct('news_sorted', 'C:\\xampp\\htdocs...')
    #1 …\vendor\contao\manager-bundle\src\HttpKernel\ContaoKernel.php(232): Contao\ManagerPlugin\Bundle\Config\ModuleConfig->getBundleInstance(Object(Contao\ManagerBundle\HttpKernel\ContaoKernel))
    #2 …\vendor\contao\manager-bundle\src\HttpKernel\ContaoKernel.php(53): Contao\ManagerBundle\HttpKernel\ContaoKernel->addBundlesFromPlugins(Array)
    #3 …\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php(450): Contao\ManagerBundle\HttpKernel\ContaoKernel->registerBundles()
    #4 …\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\K in …\vendor\contao\core-bundle\src\HttpKernel\Bundle\ContaoModuleBundle.php on line 36

    The only way to uninstall such an extension is by deleting the extension folder and then deleting var/cache/prod manually.

ghost commented 7 years ago

Comment by @aschempp July 18th, 2017, 13:58 GMT

This is a manager-bundle issue not core-bundle.

No idea how to fix though 😔

ghost commented 7 years ago

Comment by @fritzmg July 18th, 2017, 14:00 GMT

Hm, true, in the standard-edition it would not happen, because you would have to manually remove it from the AppKernel anyway.

leofeyer commented 7 years ago

Which is probably one of the reasons why Symfony does not implement bundle autoloading.

fritzmg commented 7 years ago

Installing a Contao 3 extension that is compatible with Contao 4 via

composer require …

then setting it up in the Install Tool and then again deinstalling it via

composer remove …

causes no trouble during the cache:clear operation. This is because ScriptHandler::initializeApplication manually clears the cache (ScriptHandler::purgeCacheFolder) before any of the other operations.

aschempp commented 7 years ago

You're right. So this is actually not a bug, if you manually delete an extension folder you need to manually remove the cache…