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

Multisite plugin and theme installs go to the main /user directories #319

Closed
ghost opened this issue Dec 2, 2015 · 21 comments
Closed

Multisite plugin and theme installs go to the main /user directories #319

ghost opened this issue Dec 2, 2015 · 21 comments

Comments

@ghost
Copy link

ghost commented Dec 2, 2015

The instructions for Multisite installation are great but it seems that the Admin plugin doesn't install/update plugins or themes into the relevant directories for the site but just into the top level /user/plugins/ and /user/themes/ directories.

@rhukster
Copy link
Member

rhukster commented Dec 2, 2015

Hey Sean, please add this on the grav-learn repo. This is the admin repo. https://github.com/getgrav/grav-learn

@rhukster rhukster closed this as completed Dec 2, 2015
@ghost
Copy link
Author

ghost commented Dec 2, 2015

Hi Andy

I was told here (getgrav/grav#472) to add it to the Admin repo.

The issue is not with the Instructions in the documentation but that the Admin plugin installs/updates the plugins and themes into the top level rather than into the relevant site's plugin and theme directories in a Multisite setup.

@rhukster
Copy link
Member

rhukster commented Dec 2, 2015

Well actually its a combination of both documentation and Grav core, but its not really the admin (i think).

The main thing is you would need to create a user/plugins and user/themes folder in each of your 'sites' then plugins/themes should be installed there by default.

I can't guarantee this works, and if it does not, then that's a bug in the core of Grav in how the streams are setup.

However, if it does work, then that needs to be added to the docs :)

The admin being the culprit is unlikely but possible.

The multisite support really is based on some flexible configuration of PHP streams so Grav will look for things and find things in a certain order (falling back through the stream configuration if it doesn't exist). We obviously can't really test every combination because the flexibility of the approach means there's really no limit to those combinations. We'll just have to address each question as we come to it.

@ghost
Copy link
Author

ghost commented Dec 2, 2015

This is the directory structure I have been trying so far:

  • user
    • plugins - Plugins are being installed here rather than the the sites
    • sites
      • one.domain.com
        • ...
        • plugins
        • themes
      • two.domain.com
        • ...
        • plugins
        • themes
    • themes - Themes are being installed into here and not into the sites

I don't know where the issue should be added to though :-(

@Sommerregen
Copy link
Contributor

Hi @seandowney ,

I have written the multisite documentation. TL;TR it's neither a grav core nor a grav admin plugin issue. It's how you setup the streams and where you log in. I guess you tried logging in from your "base domain" and not from "one.domain.com" or "two.domain.com" (or even used GPM)? Maybe that's something, which has to go into the docs. Can you add it then?

If you log-in into the respective sites and do the update(s) there, plugins/themes etc. should be installed where you want to. I have multisites running and provided several improvements in order to make it work, otherwise you have found a really special bug.

FYI I have a Multisite plugin in development, which will simplify those things. I hope I will release it, when Admin plugin is considered stable and the Pro version comes out.

@ghost
Copy link
Author

ghost commented Dec 4, 2015

Hi @Sommerregen

Thank you for the documentation. I am using the setup.php code snippet from the doc for the sub-domain sites but I am using it for two different domains. I am logging into the admin on each domain separately but it still updates/installs the plugins and themes to the top level. I don't have a base domain pointing at the Grav install.

The admin does use the plugins from the sites plugins folder but updating puts the update into the top level.

I'm new to Grav, could you give me a pointer where I should start with some debugging on the streams?

Thanks again

@ghost
Copy link
Author

ghost commented Dec 5, 2015

I did as much debugging as I could and it seems that the GPM class is used to load the package install_path but it doesn't use correct directory for the multisite?

@flaviocopes
Copy link
Contributor

Will try to recreate this

@ghost
Copy link
Author

ghost commented Dec 5, 2015

I did some more debugging, it seems the package install_path comes in from http://getgrav.org/downloads/plugins.json in Grav\Common\GPM\Remote\Plugins and the constructor in AbstractPackageCollection but it never gets changed to the stream value?

@flaviocopes
Copy link
Contributor

@Sommerregen do you have the Admin plugin working in a multisite? Can you paste your setup.php file?

@Sommerregen
Copy link
Contributor

@flaviocopes Yes, I have. Unfortunately, I can't test my multisite environment at the moment, which is broken due to the latest changes made in grav core (refactoring of config class). I'm working on that and will test it as soon as I can. I will leave a note here.

@flaviocopes
Copy link
Contributor

If that is related to $configuration $container not being available: getgrav/grav#511

I asked because I have some issues too, running Admin (assets paths are wrong, for example) - the rest seems to work.

@flaviocopes
Copy link
Contributor

@seandowney what's your setup.php file content? Is it the default you found on the Learn site?

@Sommerregen
Copy link
Contributor

Hi @flaviocopes yes that's related to $container not being available, but there are other issues as well I'm experiencing. I have fixed some, but somehow my paths are wrong, too. Atm this is my pages path... Have time tomorrow to dig in and to solve it. For the meantime your PR looks good!

@ghost
Copy link
Author

ghost commented Dec 8, 2015

@flaviocopes yes the same code from the documentation for sub domains. I'm not using it with sub domains but everything else works except the install /upgrade of plugins and themes.
Thanks

@ghost
Copy link
Author

ghost commented Dec 30, 2015

Hi @flaviocopes @Sommerregen is there anything I can do to help on this?

@Sommerregen
Copy link
Contributor

Hi @seandowney sorry I was on holiday for a long time. I've updated my server now to Grav v1.0.8 and my multisite setup is now running. Thus, I'm able to test the issue now and will report, when I have something for you to test.

@ghost
Copy link
Author

ghost commented Jan 16, 2016

Hi @Sommerregen Ok great thank you

@Sommerregen
Copy link
Contributor

@seandowney I can confirm the issue. Independent of your stream setup, Grav will always install plugins and themes to user/plugins or user/themes. This has something to do with the way how the GPM class resolves the install path. It get's it from the json e.g. https://getgrav.org/downloads/plugins.json via the install_path variable for each entry.

I have talked to @rhukster since it has to be changed on getgrav to use a stream locator like user:// instead, which probably involves some modifications in the core, too. Thus, stay tuned.

A really dirty fix for the moment would be to add

if (isset($data['install_path'])) {
  $path = preg_replace('~^user/~i', 'user://', $data['install_path']);
  $data['install_path'] = self::getGrav()['locator']->findResource($path, false, true);
}

before https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/GPM/Remote/AbstractPackageCollection.php#L40 .

@ghost
Copy link
Author

ghost commented Jan 21, 2016

@Sommerregen that's great, thanks for your time investigating, finding the cause and providing a temporary fix.

Thanks very much

@hi-ko
Copy link

hi-ko commented Jun 20, 2018

The easiest work around we now use is to create symlinks for plugins, themes in sites. We do the same for pages/pagetrees from other sites we want to "reuse" in other sites. Since this only works in *nix systems the best longterm solution would be to support something like placeholders which could be resolved by grav and/or a global config which supports a resolution hierachy where to look for config similar to the language handling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants