Commit c1c1e975 authored by anarcat's avatar anarcat Committed by anarcat

rename the vhost_config hook to apache_vhost_config host and create a...

rename the vhost_config hook to apache_vhost_config host and create a apache_dir_config hook to add configuration to the platformwide apache configuration

include a basic .htacces configuration there, but still allow the .htaccess to override while i do some tests

See: #384972
parent 018c08fe
......@@ -10,6 +10,6 @@
/**
* implementation of hook_provision_vhost_extra
*/
function provision_itk_provision_vhost_config($url) {
function provision_itk_provision_apache_vhost_config($url) {
return "# Configur ITK permissions\nAssignUserID ". drush_get_option('web_user') . ' #' . drush_get_option('web_group') . "\n";
}
......@@ -58,3 +58,92 @@ function provision_drupal_provision_post_verify($url = NULL) {
}
}
/**
* Inject the relevant .htacces configuration into the global apache configuration
*/
function provision_drupal_provision_apache_dir_config($data = null) {
return <<<EOF
#
# Apache/PHP/Drupal settings:
#
# Protect files and directories from prying eyes.
<FilesMatch "\.(engine|inc|info|install|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl|svn-base)$|^(code-style\.pl|Entries.*|Repository|Root|Tag|Template|all-wcprops|entries|format)$">
Order allow,deny
</FilesMatch>
# Don't show directory listings for URLs which map to a directory.
Options -Indexes
# Follow symbolic links in this directory.
Options +FollowSymLinks
# Make Drupal handle any 404 errors.
ErrorDocument 404 /index.php
# Force simple error message for requests for non-existent favicon.ico.
<Files favicon.ico>
# There is no end quote below, for compatibility with Apache 1.3.
ErrorDocument 404 "The requested file favicon.ico was not found.
</Files>
# Set the default handler.
DirectoryIndex index.php
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.
# PHP 4, Apache 1.
<IfModule mod_php4.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0
</IfModule>
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1
</IfModule>
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>
EOF;
}
\ No newline at end of file
......@@ -84,10 +84,7 @@ function _provision_apache_create_vhost_config($url, $template = NULL) {
$template = _provision_apache_default_template();
}
$options['extra_config'] = "# Extra configuration from modules:\n";
foreach (drush_command_implements('provision_vhost_config') as $module) {
$options['extra_config'] .= "# -- $module settings --\n";
$options['extra_config'] .= module_invoke($module, 'provision_vhost_config', $url, $options) . "\n";
}
$options['extra_config'] .= join("\n", drush_command_invoke_all('provision_apache_vhost_config', $url, $options));
return _provision_apache_create_config($url, $options, $template);
}
......
<Directory <?php print $publish_path; ?>>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
<?php print $extra_config; ?>
</Directory>
......@@ -5,6 +5,9 @@ function provision_apache_provision_verify($url) {
_provision_create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
$data = drush_get_merged_options();
$options = drush_get_context('options');
$data['extra_config'] = "# Extra configuration from modules:\n";
$data['extra_config'] .= join("\n", drush_command_invoke_all('provision_apache_dir_config', $data));
drush_log('invoked, got: ' . var_export($data['extra_config'], TRUE));
_provision_apache_create_config('_platform_' . $options['platform'] . '.conf', $data, _provision_apache_platform_template());
}
else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment