Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi guys,
I have a case where I need to append to the vhost config template created in provision_apache.drush.inc
At the moment redirection and aliases can add to the template in _provision_apache_create_vhost_config(). Here is a patch that allows other drush modules to do the same.
Cheers,
Ben
Comment | File | Size | Author |
---|---|---|---|
#15 | provision-709862-swappable-templates.patch | 1.78 KB | Steven Jones |
aegir_vhost_template_hook.patch | 1.02 KB | benkant |
Comments
Comment #1
adrian CreditAttribution: adrian commentedwe already have a hook for this
Comment #2
anarcat CreditAttribution: anarcat commentedWell, this is different: the hook allows *templates* to be added, as opposed to adding stuff to within the block. This could make the redirection code a lot cleaner for example:
Comment #3
benkant CreditAttribution: benkant commentedYep, this patch is to allow you to add to the template file, outside of the existing VirtualHost block.
Comment #4
simeWith this feature you'd have two separate methods to add to a vhost file.
I had a desire earlier today to be able to replace * with an IP. That's a third that AFAICT is not covered by this.
Is there a place for drupal_alter on a whole vhost contents?
Comment #5
benkant CreditAttribution: benkant commentedPerhaps being able to alter the whole vhost contents would take care of all possible issues that might arise with this config file.
Comment #6
simeI feel that too benkant. If that was in place then we could solve unusual setups with 3rd party addons (or roll your own).
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedCould we please have a new patch rolled against the latest in git master branch (multiserver got merged in and everything is different in provision now)
Thanks!
Comment #8
benkant CreditAttribution: benkant commentedStay tuned I will roll a new patch when I'm back at work Monday.
Comment #9
benkant CreditAttribution: benkant commentedWe're not on HEAD anymore and are using releases. Any chance someone else can reroll this?
Comment #10
adrian CreditAttribution: adrian commentedhead is now completely completely different.
just so you know.
Comment #11
adrian CreditAttribution: adrian commentedok.
we can't alter the contents of the vhost, because we dont actually have a full representation of it.
we would need to write a parser for virtualhost files and then rewrite it for each of the additional web servers.
Another thing, is that with additional web servers being added , there's a high likelihood that your code will either break or best case scenario be completely ignored with other services.
i'm looking at what i can do in the config classes though.
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedThe current API for provision_apache_vhost_config (and the platform and server ones) allow you to return a path to a .tpl.php rather than just raw data to be injected.
I don't know if that is enough to consider this fixed or not yet. I really find the case of 'i can't inject into a vhost and need to add a whole 'nother vhost or manage the whole thing' to be somewhat of a corner case, except maybe the case of alias redirection where the second vhost is made up of the first Alias.
If it needs to be outside of the vhost, it can go in the platform or server wide vhosts, for which there are similar APIs for now.
Comment #13
Steven Jones CreditAttribution: Steven Jones commentedComment #14
Steven Jones CreditAttribution: Steven Jones commentedWe should probably let people who want to swap out the Aegir template files with their own easily, which afaik we don't at the moment. I think this would be the only way to cover the corner cases we have now.
Comment #15
Steven Jones CreditAttribution: Steven Jones commentedHere's a simple version. I think that we need to make it easier to make sure templates can be suggested in a specific order and we need a specific way of picking one of the suggestions.
Comment #16
anarcat CreditAttribution: anarcat commentedComment #17
Steven Jones CreditAttribution: Steven Jones commentedThis should have an alter hook, not just the invoke.
Comment #18
Steven Jones CreditAttribution: Steven Jones commentedAdded the alter hook and pushed in 6.x-2.x