Jump to content

Modules and folders?


teppo
 Share

Recommended Posts

Just wanted to make sure if I understood this correctly: modules can't be placed in /wire/modules/? At least AdminBar doesn't seem to work from there, though certain modules seem to have no problem with that. Is this just how things work or is AdminBar somehow special -- or am I doing something wrong myself? :)

Another thing is that a module seems to work properly in following directories (using FieldtypeCropImage.module as an example):

/site/modules/FieldtypeCropImage.module

/site/modules/FieldtypeCropImage/FieldtypeCropImage.module

/site/modules/shared/FieldtypeCropImage.module

/site/modules/shared/FieldtypeCropImage/FieldtypeCropImage.module

... but when placed in /site/modules/shared/Thumbnails/FieldtypeCropImage.module it won't work anymore.

Could someone please explain why this is happening? Is there some kind of "max one non-related directory between modules-directory and module / module-directory" rule or..? :)

  • Like 1
Link to comment
Share on other sites

For te second question, yes there's only one folder depth and the folder name must be the same as the module file name.

For the first question, had you tried it in site/modules ? wire/modules is for core modules only.

The idea is that you don't touch the /wire/ folder as when you upgrade you can simply replace that folder and your other modules and templates in /site/ remain unaffeccted (simple upgrades :)).

Link to comment
Share on other sites

For te second question, yes there's only one folder depth and the folder name must be the same as the module file name.

I thought module had to be in /site/modules/ModuleName/ModuleName.module but I'm a bit confused about why it actually works from /site/modules/whatever/ModuleName/ModuleName.module also -- and why won't it work when there are two odd folders (/site/modules/whatever/somethingelse/ModuleName... etc.) instead of one?

For the first question, had you tried it in site/modules ? wire/modules is for core modules only.

Yes -- and that's not the problem here. Module is working fine from site/modules. :)

What I'm wondering here is why some third party modules seem to work at /wire/modules/ and some don't.. but I'm guessing from your reply that it's considered really evil to put any non-core-modules there. Would still like to know, though.

Our upgrade process is a bit different -- many sites share one wire-folder and svn:externals combined with some shell scripting handles upgrades nicely. This way having external stuff (such as modules) within wire folder isn't actually that much of a problem and I was just experimenting if I could share modules between sites with this method.

Link to comment
Share on other sites

I thought module had to be in /site/modules/ModuleName/ModuleName.module but I'm a bit confused about why it actually works from /site/modules/whatever/ModuleName/ModuleName.module also -- and why won't it work when there are two odd folders (/site/modules/whatever/somethingelse/ModuleName... etc.) instead of one?

A module doesn't necessarily need it's own directory, you could just put it in /site/modules/. But for modules that have more than one file, it's good to put them in their own directory. The directory should be of the same name as the module. However, there are cases where you might have multiple related modules go together (like the LanguageSupport modules), so PW will let you have a dir one depth that doesn't match the module name. In that case, it's good to name it with the primary module name (with LanguageSupport again being a good example of this). The modules in /wire/modules/ also use this quite a bit for grouping, as there are dirs for Process, Fieldtype, Inputfield, etc. You can do this for 1-level but not 2. The point of this is to place some limits on the directory parser to keep things fast.

What I'm wondering here is why some third party modules seem to work at /wire/modules/ and some don't.. but I'm guessing from your reply that it's considered really evil to put any non-core-modules there. Would still like to know, though.

While it's not good to place them there, if you are aware of it and can respond properly during upgrades, I can't think of any reason why 3rd party modules wouldn't work from /wire/modules/. It seems like it should be okay. PW does keep a cache of module locations, so if it's one you had moved, that might have caused the error. But I can't think of anything else without seeing the actual error message. There aren't any real technical differences between /wire/modules/ and /site/modules/.

  • Like 2
Link to comment
Share on other sites

OK, this made things much clearer. First one is something I can definitely live with. Having two levels would've solved certain annoying issue, but I'll just solve it some other way. Second one seems to need a bit more testing, though I'm already seriously questioning whether this is the solution I want to end up with..

Anyway, thanks Ryan! :)

  • Like 1
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

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