Commit f7f88620 authored by Adrian Rossouw's avatar Adrian Rossouw

Completed getting rid of site port.

parent 1cbfe6b2
......@@ -87,7 +87,7 @@ class provisionService_http_apache extends provisionService_http {
$config = new provisionConfig_apache_server($this->context, $this->config_data());
$config->write();
dlm($config->filename());
// Create a symlink to the site specific apache config in the top level config directory of each server.
// This way you can still include the same file across all servers.
......@@ -166,7 +166,7 @@ class provisionConfig_apache_site extends provisionConfig_apache {
public $description = 'apache site configuration file';
function filename() {
return $this->data['apache_site_conf_path'] . '/' . $this->uri . '_' . $this->data['http_port'];
return $this->data['apache_site_conf_path'] . '/' . $this->uri;
}
function process() {
......
# Aegir web server configuration file
NameVirtualHost *:<?php print $web_port; ?>
NameVirtualHost *:<?php print $http_port; ?>
<VirtualHost *:<?php print $web_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
ServerName default
Redirect 404 /
</VirtualHost>
......
<VirtualHost *:<?php print $this->site_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
......
<VirtualHost *:<?php print $this->site_port; ?>>
<VirtualHost *:<?php print $http_port; ?>>
<?php if ($this->site_mail) : ?>
ServerAdmin <?php print $this->site_mail; ?>
<?php endif;?>
......
......@@ -92,7 +92,6 @@ function drush_provision_hostmaster_install($site = NULL) {
'db_server' => $server,
'uri' => $site,
'client_email' => $client_email,
'site_port' => drush_get_option('web_port', 80),
'profile' => 'hostmaster',
));
$data = provision_backend_invoke($site_name, 'provision-install');
......
......@@ -4,25 +4,12 @@
* Rebuild all the caches
*/
$GLOBALS['url'] = drush_get_option('uri');
$GLOBALS['profile'] = drush_get_option('profile');
$GLOBALS['install_locale'] = drush_get_option('language');
$GLOBALS['client_email'] = drush_get_option('client_email');
$GLOBALS['url'] = d()->uri;
$GLOBALS['profile'] = d()->profile;
$GLOBALS['install_locale'] = d()->language;
$GLOBALS['client_email'] = d()->client_email;
$GLOBALS['base_url'] = provision_get_base_url();
// url generation code, should be factored out
$proto = drush_get_option('ssl') ? 'https' : 'http';
if (drush_get_option('site_port') == 80) {
if (drush_get_option('ssl')) {
$GLOBALS['base_url'] = $proto . '://' . $GLOBALS['url'] . ':80';
}
}
elseif (drush_get_option('site_port') == 443) {
if (!drush_get_option('ssl')) {
$GLOBALS['base_url'] = $proto . '://' . $GLOBALS['url'] . ':443';
}
} else {
$GLOBALS['base_url'] = $proto . '://' . $GLOBALS['url'] . ':' . drush_get_option('site_port');
}
require_once 'includes/install.inc';
......
......@@ -4,24 +4,12 @@
* Rebuild all the caches
*/
$GLOBALS['url'] = drush_get_option('uri');
$GLOBALS['profile'] = drush_get_option('profile');
$GLOBALS['install_locale'] = drush_get_option('language');
$GLOBALS['client_email'] = drush_get_option('client_email');
// url generation code, should be factored out
$proto = drush_get_option('ssl') ? 'https' : 'http';
if (drush_get_option('site_port') == 80) {
if (drush_get_option('ssl')) {
$GLOBALS['base_url'] = $proto . '://' . $GLOBALS['url'] . ':80';
}
}
elseif (drush_get_option('site_port') == 443) {
if (!drush_get_option('ssl')) {
$GLOBALS['base_url'] = $proto . '://' . $GLOBALS['url'] . ':443';
}
} else {
$GLOBALS['base_url'] = $proto . '://' . $GLOBALS['url'] . ':' . drush_get_option('site_port');
}
$GLOBALS['url'] = d()->uri;
$GLOBALS['profile'] = d()->profile;
$GLOBALS['install_locale'] = d()->language;
$GLOBALS['client_email'] = d()->client_email;
$GLOBALS['base_url'] = provision_get_base_url();
require_once 'includes/install.inc';
define('MAINTENANCE_MODE', 'install');
......
......@@ -4,10 +4,11 @@
* Rebuild all the caches
*/
$GLOBALS['url'] = drush_get_option('uri');
$GLOBALS['profile'] = drush_get_option('profile');
$GLOBALS['install_locale'] = drush_get_option('language');
$GLOBALS['client_email'] = drush_get_option('client_email');
$GLOBALS['url'] = d()->uri;
$GLOBALS['profile'] = d()->profile;
$GLOBALS['install_locale'] = d()->language;
$GLOBALS['client_email'] = d()->client_email;
$GLOBALS['base_url'] = provision_get_base_url();
define('MAINTENANCE_MODE', 'install');
......
......@@ -496,7 +496,6 @@ class provisionSite extends provisionEnvironment {
'--platform' => 'site: the platform the site is run on',
'--db_server' => 'site: the db server the site is run on',
'--uri' => 'site: example.com URI, no http:// or trailing /',
'--site_port' => 'site: port the site is hosted on; default 80',
'--language' => 'site: site language; default en',
'--aliases' => 'site: comma-separated URIs',
'--redirection' => 'site: boolean for whether --aliases should redirect; default false',
......@@ -523,7 +522,6 @@ class provisionSite extends provisionEnvironment {
$this->setProperty('site_enabled', true);
$this->setProperty('language', 'en');
$this->setProperty('site_port', 80);
$this->setProperty('client_email');
$this->setProperty('aliases', array(), TRUE);
$this->setProperty('redirection', FALSE);
......
......@@ -46,6 +46,21 @@ function provision_is_local_host($host) {
return ($host == 'localhost') || ($host == '127.0.0.1') || ($host == strtolower(php_uname('n')));
}
/**
* Retrieve a base_url for the currently active site.
*
* TODO: when we actually support HTTPS, do this correctly.
*/
function provision_get_base_url() {
$base_url = 'http://' . d()->uri;
$http_port = d()->web_server->http_port;
if (!is_null($http_port) && ($http_port != 80)) {
$base_url .= ':' . $http_port;
}
return $base_url;
}
/**
* Save modified options to the drushrc.php file
*/
......
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