bedrock-autoloader
bedrock-autoloader copied to clipboard
Autoloader wont load mu-plugins if plugins directory is a symlink
- [x] I've read the guidelines for Contributing to Roots Projects
- [x] This request isn't a duplicate of an existing issue
- [x] I've read the docs and followed them (if applicable)
- [x] This is not a personal support request that should be posted on the Roots Discourse community
Not sure if I should put this on roots/bedrock or here, but:
Description
The autoloader doesnt load mu-plugins if plugins directory is a symlink. This is due to opendir failing in get_plugins().
Steps to reproduce
- Symlink plugins directory to anywhere
- Autoloader fails
Expected behavior: it to work Actual behavior: opendir fails in the get_plugins function
Reproduces how often: Always if plugins dir is symlinked
Versions
Latest Trellis & Bedrock setup
Additional information
In my Trellis setup I set project_shared_childeren to include the plugins directory. I use this setup for satispress, where I want plugins and themes outside my git, but some plugins installed as mu-plugin (like satispress itself).
is this issue for this repo? this isn't being used in bedrock yet, but the autoloader in bedrock was updated yesterday
https://github.com/roots/bedrock/pull/437
what version of bedrock are you using — master with that commit, or the latest release (1.12.6)?
Hi, I've just created bedrock using the latest master. I'm aware this isn't in bedrock yet, but its autoloader-related. I'm happy to post this issue to roots/bedrock instead of here if you want to. I've got autoloader working by adding its own get_plugin function. https://gist.github.com/Xilonz/8b62cc5bc5b7f3b8ae175f751688a2b9
I realise this is an old issue but seeing as it's still open, and I'm still running into the same issue (SatisPress with symlinked plugins directory), is there a chance this could be revisited? It looks like @Xilonz fixed the issue for himself by essentially copy-pasting the WP core get_plugins function with a tiny tweak. That works, but it's not the most elegant solution. Perhaps there's a better way to achieve this?
Edit: Until a better solution is available, adapting the newest version of the Bedrock Autoloader using Xilonz' solution works, by replacing Line 213 of his gist, i.e. replace
$plugin_root = dirname(__FILE__);
with
$plugin_root = WPMU_PLUGIN_DIR;
The $relativePath instance variable can be removed that way. This is necessary because the Autoloader class now resides in a different place inside this package, rather than in the mu-plugins directory itself.