Jump to content

Sharing Modules Within MultiSite Setup


ethanbeyer
 Share

Recommended Posts

I have a question about Multiple Site implementation, and how to possible "share" modules between them.

First, required reading: https://processwire.com/api/modules/multi-site-support/  I'm dealing with Option #1.
The way this works is that in the root directory of a site, there is an index.config.php file that denotes what domain is mapped to which site-*/ directory.

The project I am working on has three site-*/ directories, each with their own site-*/modules/ directory.
What has happened is that a lot of the modules from site to site are the same.

I was wondering if there was any way to "share" modules between sites in the Multiple Site setup, via symlink or alias, or potentially if there was some roadmapped feature that @ryan has planned to solve this issue.

Either way, any help/pointers would be appreciated!

Link to comment
Share on other sites

Symlinks will surely work, but really if you're separating them in different sites, why couple them together via modules? I can see the appeal, but really it's a bit more initial work for more freedom later. Also multi site setups are rather rarely used, so I'm not sure if there will be much of a roadmap for the feature.

Link to comment
Share on other sites

Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php:

$config->paths->siteModules = $config->paths->root . 'shared/modules/';
$config->urls->siteModules = $config->urls->root . 'shared/modules/';

 

  • Like 1
Link to comment
Share on other sites

17 hours ago, Robin S said:

Not saying it's a good idea because I have no idea how stable it would be, but if you wanted to share all the modules between the sites you could do something like this in each /site/config.php:


$config->paths->siteModules = $config->paths->root . 'shared/modules/';
$config->urls->siteModules = $config->urls->root . 'shared/modules/';

 

Interesting solution. On my local/dev setup I use Symlinks as I need to easily test my modules in different PW installs. 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Had to report back and say that in a multi-site environment, where all the sites are using the same ProcessWire core, it is possible to "share" modules by the method listed above, with no need for symlinks!

$config->paths->siteModules = $config->paths->root . 'shared/modules/';
$config->urls->siteModules = $config->urls->root . 'shared/modules/';

 

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...