It has been a standard practice since 2009 to put all exported features into the "sites/all/modules/features" directory rather than just "sites/all/modules", likewise distributions put their custom features into "profiles/[distro]/modules/features". As a result, the default location in Features v2 should be to generate the exported features in "sites/all/modules/features" rather than "sites/all/modules".
Solution that was implemented
One can now run e.g.
drush vset features_default_export_path "sites/all/modules/features"
to set the destination directory.
Or go to "admin/structure/features/settings", there is an option "Default export path" at the bottom in "General settings".
Comment | File | Size | Author |
---|---|---|---|
#14 | features-1915462-configurable_export_directory.patch | 7.95 KB | Les Lim |
#9 | features-n1915462-9.patch | 8.15 KB | DamienMcKenna |
#6 | features-n1915462-6.patch | 5.12 KB | DamienMcKenna |
#5 | features-n1915462-5.patch | 5.53 KB | DamienMcKenna |
#1 | features-n1915462-1.patch | 5.12 KB | DamienMcKenna |
Comments
Comment #1
DamienMcKennaThis changes the default destination used by both the Drush integration and the website UI to use "sites/all/modules/features" instead of "sites/all/modules".
Comment #2
DamienMcKennaComment #3
DamienMcKennaComment #5
DamienMcKennaI'm not sure what the errors had to do with it, but I caught another occurrence of "sites/all/modules".
Comment #6
DamienMcKennaRerolled.
Comment #7
hefox CreditAttribution: hefox commentedMakes some sense, but how about a variable_get('features_default_export_path', FEATURES_DEFAULT_EXPORT_PATH);? There's a settings tab now where such settings can go.
Comment #8
DamienMcKennaGood idea. I'll try to work on an updated patch this week.
Comment #9
DamienMcKennaHow about this? One difficulty is that the Drush integration displays the path, so I've made it show the default 'sites/all/modules/features' if the module is not enabled and once it's enabled it checks the variable.
Comment #11
hefox CreditAttribution: hefox commented#9: features-n1915462-9.patch queued for re-testing.
Comment #12
mpotter CreditAttribution: mpotter commentedCommitted to 1fbf522.
Comment #14
Les LimThe patch in #6 was committed, but not the patch in #9 that makes the default export directory configurable.
Re-rolled #9 against 7.x-2.x-dev.
Comment #15
mpotter CreditAttribution: mpotter commentedThis seems to work well. Sorry I missed #9 somehow!
Comment #16
mpotter CreditAttribution: mpotter commentedHrm. hefox raised a good question with me. How can we use a default of "sites/all/modules/features" (as in the patch) when that is the directory that Drupal downloads the actual Features module itself?
The default in the patch works well on sites that put contrib modules into sites/all/modules/contrib, but that doesn't happen by default.
Comment #17
DamienMcKennaHow about changing the default depending on where the Features module is installed? For example, if features.module is in sites/all/modules/features then use e.g. "sites/all/modules/custom_features", otherwise use "sites/all/modules/features"?
Comment #18
Les LimWhat about just "sites/all/modules/custom"? That's where we prefer to put our features where I work, which is why we wanted the configurable default. Since we often add hooks and other custom code into our feature modules, there isn't really a brightline between a "custom" module and a "feature" module.
Comment #19
DamienMcKenna@Les: I use three paths for modules:
Comment #20
hefox CreditAttribution: hefox commentedSomething I noticed last night
If you aren't using contrib directory drush dl features is at sites/all/modules/features
sooo you go into features create and go to use this tool.. and make your feature under features module? XD!
Comment #21
hefox CreditAttribution: hefox commentedI finally figured out where I was going with the above insight
if drupal_get_path('module', 'features') == 'sites/all/modules/features' default directory needs to be sites/all/modules or such
Comment #22
impleri CreditAttribution: impleri commentedCan this just be made into a variable (that can be exported) and let people decide for themselves? Perhaps have it set by default to sites/all/modules/features, but since it's a variable, it can be changed at will.
Comment #23
mpotter CreditAttribution: mpotter commentedModified the default to be sites/all/modules. But the patch #14 implements this as a variable (as per #22) so it can be changed as needed and that was still a useful addition.
Committed to b1549d8.
Somebody else can submit a patch to a new issue to change the default based upon the path of the Features module as a new feature request.
Comment #24
DamienMcKenna@mpotter: Thanks. I've opened a new issue: #2103157: Change features_default_export_path based on location of Features module
Comment #26
donquixote CreditAttribution: donquixote as a volunteer commentedThis is one of the first results in google when looking how to set the destination directory. And I did not find much else.
So we should add something helpful to the issue summary.
I am adding a section "Solution that was implemented", based on what I found from a quick look into the patch.
Please consider this a stub, to be expanded upon.
And if there is a doc page elsewhere, add a link!
Comment #27
donquixote CreditAttribution: donquixote as a volunteer commented