Open gwharton opened 2 months ago
Thanks for the issue. As stated in the comment linked from the function doc, if the method doesn’t return a relative path, it causes issues with instances in a virtualized environment, if the cleaner is run outside the virtual environment, and the path to the base dir differs in the container and outside.
I currently see no easy way to change that while still supporting that kind of scenario.
Yeah, I can see the dilema. Its unfortunate as symlinking in external modules into vendor, is core composer functionality, and a common development use case.
Workaround is to ensure that third party/external/shared modules are checkout out under the magento base root, e.g <magentobaseroot>/ext/<vendor>/<module>
and then the file based repository path set to ext// in composer.json
The downside being if the modules are shared between several projects, you have to have multiple copies checked out.
If the default logic cannot be changed, then perhaps a command line argument could be the way forward to allow both schemes to coexist? Something to ponder over.
The
\Magento\Framework\Component\ComponentRegistrar->getPaths('module')
command returns paths outside of the magento basedir when modules are symlinked in by composer into vendor from outside of the magento basepath.
The removal of basepath from these modules path (who's path doesnt start with basepath) causes the path to be butchered by removing a fixed length string (length of basepath + 1) from the beginning of the path.
https://github.com/mage2tv/magento-cache-clean/blob/20c729577afdb2c2c39f7c5b332386c55349dfdb/src/cache/config/php.cljs#L38-L58