Skip to content

Instantly share code, notes, and snippets.

@jonpugh
Created September 24, 2015 15:40
Show Gist options
  • Save jonpugh/40a1bd77cd8dc1a59198 to your computer and use it in GitHub Desktop.
Save jonpugh/40a1bd77cd8dc1a59198 to your computer and use it in GitHub Desktop.
This drush file adds to aegir apache config, when a site is protected by http basic authentication, it grants access to the site's files folder without a password.
<?php
/*
* Implementation of hook_provision_apache_vhost_config()
*/
function http_passwords_provision_apache_vhost_config($uri, $data) {
$lines = array();
$user = d()->http_basic_auth_username;
$pass = d()->http_basic_auth_password;
if (!empty($user) && !empty($pass)) {
$root = d()->root;
$lines[] = " <Directory \"$root/sites/$uri/files\">";
$lines[] = " Require all granted ";
$lines[] = " </Directory>";
$lines[] = "";
}
return implode("\n", $lines);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment