contao / manager-plugin

Contao Manager Plugin
GNU Lesser General Public License v3.0
4 stars 9 forks source link

Automatically skip broken symlinks in system/modules #55

Closed aschempp closed 7 months ago

aschempp commented 8 months ago

If there is a symlink in system/modules to a vedor/... folder that no longer exists, the plugin currently tries to create a ModuleBundle for it, which fails because the source cannot be found. I think we can safely skip broken symlinks when loading modules.

Maybe @fritzmg can manually test if this also works on Windows? I manually created three folders in system/modules, a regular one, a working symlink and a broken symlink, and is_dir "correctly" returned false on the broken symlink. I hope Windows does that too? 😅

fritzmg commented 8 months ago

Hm, how exactly can I reproduce this? Because if the target folder in vendor/ does not exist anymore, the symlink will be removed anyway and thus this error should never really occur?

aschempp commented 8 months ago

I would try to manually create a symlink in system/modules and then remove the source. Then run contao:setup to rebuild the bundles. Without this change, the build process should fail with e message about the module not being found.

fritzmg commented 8 months ago

But how would this happen in the real world?

aschempp commented 8 months ago

I think in my case Composer tried to uninstall an extension but the contao-community-alliance/composer-plugin did not run successfully to remove the symlink. I guess Composer removed one extension but failed on the next one, so the plugin did not run at all (because Composer aborted the process). Maybe even because of a 30sec limit.

fritzmg commented 8 months ago

In any case the is_dir check works 👍.

leofeyer commented 7 months ago

Thank you @aschempp.