Commit 1ce0ae89 authored by anarcat's avatar anarcat Committed by anarcat

#515052 by David Goode and me - allow arbitrary ports in the backend

parent ea9dafc1
......@@ -8,6 +8,18 @@ $GLOBALS['url'] = drush_get_option('site_url');
$GLOBALS['profile'] = drush_get_option('profile');
$GLOBALS['install_locale'] = drush_get_option('language');
$GLOBALS['client_email'] = drush_get_option('client_email');
switch(drush_get_option('site_port')) {
case 80:
$base_url = 'http://' . $GLOBALS['url'];
break;
case 443:
$base_url = 'https://' . $GLOBALS['url'];
break;
default:
$base_url = 'http://' . $GLOBALS['url'] . ':' . drush_get_option('site_port');
break;
}
$GLOBALS['base_url'] = $base_url;
require_once 'includes/install.inc';
......@@ -60,6 +72,7 @@ function install_create_admin_user($client_email = NULL) {
}
function install_send_welcome_mail($url, $account, $profile, $language, $client_email) {
global $base_url;
// Mail one time login URL and instructions.
$from = variable_get('site_mail', ini_get('sendmail_from'));
$onetime = user_pass_reset_url($account);
......
......@@ -8,6 +8,18 @@ $GLOBALS['url'] = drush_get_option('site_url');
$GLOBALS['profile'] = drush_get_option('profile');
$GLOBALS['install_locale'] = drush_get_option('language');
$GLOBALS['client_email'] = drush_get_option('client_email');
switch(drush_get_option('site_port')) {
case 80:
$base_url = 'http://' . $GLOBALS['url'];
break;
case 443:
$base_url = 'https://' . $GLOBALS['url'];
break;
default:
$base_url = 'http://' . $GLOBALS['url'] . ':' . drush_get_option('site_port');
break;
}
$GLOBALS['base_url'] = $base_url;
require_once 'includes/install.inc';
define('MAINTENANCE_MODE', 'install');
......@@ -62,6 +74,7 @@ function install_create_admin_user($client_email = NULL) {
}
function install_send_welcome_mail($url, $account, $profile, $language, $client_email) {
global $base_url;
// Mail one time login URL and instructions.
$from = variable_get('site_mail', ini_get('sendmail_from'));
$onetime = user_pass_reset_url($account);
......
......@@ -83,6 +83,10 @@ function _provision_apache_delete_vhost_config($url) {
*/
function _provision_apache_create_vhost_config($url, $template = NULL) {
$options = drush_get_merged_options();
// backward compatibility with 0.3
if (!$options['site_port']) {
$options['site_port'] = 80;
}
if (is_null($template)) {
$template = _provision_apache_default_template();
}
......@@ -95,6 +99,19 @@ function _provision_apache_create_vhost_config($url, $template = NULL) {
return _provision_apache_create_config($url, $options, $template);
}
function _provision_apache_create_server_config($url) {
$options = drush_get_merged_options();
$template = _provision_apache_default_server_template();
$options['extra_config'] = "# Extra configuration from modules:\n";
$options['extra_config'] .= join("\n", drush_command_invoke_all('provision_apache_server_config', $url, $options));
return _provision_apache_create_config($options['web_host'] .".server", $options, $template);
}
function _provision_apache_default_server_template() {
return file_get_contents(dirname(__FILE__) ."/provision_apache_server.tpl.php");
}
/**
* Write an apache configuration file
*/
......
# Aegir web server configuration file
<?php if (is_array($web_ports)) :
foreach ($web_ports as $web_port) :?>
NameVirtualHost *:<?php print $web_port; ?>
<?php
endforeach;
endif;
?>
<?php print $extra_config; ?>
<VirtualHost *:80>
<VirtualHost *:<?php print $site_port; ?>>
<?php if ($site_mail) : ?>
ServerAdmin <?php print $site_mail; ?>
<?php endif;?>
......
<VirtualHost *:80>
<VirtualHost *:<?php print $site_port; ?>>
<?php if ($site_mail) : ?>
ServerAdmin <?php print $site_mail; ?>
<?php endif;?>
......
......@@ -8,6 +8,7 @@ function drush_provision_apache_provision_verify($url = null) {
$data['extra_config'] = "# Extra configuration from modules:\n";
$data['extra_config'] .= join("\n", drush_command_invoke_all('provision_apache_dir_config', $data));
_provision_apache_create_config('platform_' . $options['platform'] . '.conf', $data, _provision_apache_platform_template());
_provision_apache_create_server_config($url);
}
else {
_provision_apache_create_vhost_config($url);
......
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