Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoloader wont load mu-plugins if plugins directory is a symlink #12

Open
4 tasks done
Xilonz opened this issue Jun 10, 2019 · 3 comments
Open
4 tasks done

Autoloader wont load mu-plugins if plugins directory is a symlink #12

Xilonz opened this issue Jun 10, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@Xilonz
Copy link

Xilonz commented Jun 10, 2019

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

  1. Symlink plugins directory to anywhere
  2. 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).

@retlehs
Copy link
Sponsor Member

retlehs commented Jun 10, 2019

is this issue for this repo? this isn't being used in bedrock yet, but the autoloader in bedrock was updated yesterday

roots/bedrock#437

what version of bedrock are you using — master with that commit, or the latest release (1.12.6)?

@Xilonz
Copy link
Author

Xilonz commented Jun 10, 2019

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

@retlehs retlehs added the bug Something isn't working label May 16, 2020
@Ririshi
Copy link

Ririshi commented May 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants