Jump to content

Is there a disadvantage to adding modules to /wire?


Recommended Posts

Posted

I'd like to symlink the /site/modules directory  so I centrally maintain them for multiple sites, but there are path issues with doing that - particularly with multi-lingual sites, I think. 

If I'm careful when upgrading ProcessWire (only overwriting core modules in wire/modules when upgrading), is there any other disadvantage to putting common modules used by all sites into the wire/modules directory in a multi website setup?  I'm using the 'separate database per site' method.

Thanks for your help,

-Brent

Posted

It does make your upgrade task a lot more difficult, but ProcessWire itself doesn't care if you put modules in /wire/modules/ rather than /site/modules/.

Posted

But by the same token, there's no big problem with just putting modules as you need them on a project into your central site/modules directory - if I understand your setup correctly they won't add any overhead until you actually install them on a specific site anyway, they'll just sit there ready to install.

Posted

Thanks gentlemen.

Ryan - would it be difficult to add a shared modules directory that ProcessWire could be configured to look for? Something like:

/wire/

/modules/

/site/

/site-example1/

/site-example2/

Perhaps you could add a preference in "/index.config.php" , since that's where you'd set up the domain routing for multiple sites anyway? That way, the default single-site install doesn't have the overhead/complexity, but a multi-site install could take advantage?

  • Like 2
Posted
Ryan - would it be difficult to add a shared modules directory that ProcessWire could be configured to look for? Something like:

same for themes :)

  • Like 1
Posted

Good call diogo!  Ideally the admin theme should be shared too. Maybe something more like this then:

/wire/

/shared/

   /modules/

   /templates-admin/

/site/

/site-example1/

/site-example2/

  • Like 3
Posted

Sounds interesting. I'll look into this as a future option, as it would make a lot of sense in a single-install, multi-site environment.

  • Like 3
  • 1 month later...
Posted

As a temporary solution, I've had success adding a 'global' folder containing  "templates-admin" and "modules". Then I modified index.php (in the root of  the ProcessWire install) like so (modified lines marked with a comment):

 

    /*
    * Setup configuration data and default paths/urls
    *
    */
    $config = new Config();
    $config->urls = new Paths($rootURL); 
    $config->urls->wire = "$wireDir/";
    $config->urls->site = "$siteDir/";
    $config->urls->modules = "$wireDir/modules/";

  //EDITED HERE
    $config->urls->siteModules = "global/modules/";  

    $config->urls->core = "$coreDir/"; 
    $config->urls->assets = "$assetsDir/";
    $config->urls->cache = "$assetsDir/cache/";
    $config->urls->logs = "$assetsDir/logs/";
    $config->urls->files = "$assetsDir/files/";
    $config->urls->tmp = "$assetsDir/tmp/";
    $config->urls->templates = "$siteDir/templates/";

 //EDITED HERE
    $config->urls->adminTemplates = is_dir("global/$adminTplDir") ? "global/$adminTplDir/" : "$wireDir/$adminTplDir/"; 

    $config->paths = clone $config->urls; 
    $config->paths->root = $rootPath . '/';
    $config->paths->sessions = $config->paths->assets . "sessions/";
 

It would be great if the file used for routing (index.config.php) could handle this kind of override, so that we don't have to worry about replacing index.php during upgrades...

Hope that helps someone!

  • Like 1

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...