Site.php in Aegir HTTPS 7.3
File
drush/Provision/Config/Http/Https/Site.php
View source
<?php
class Provision_Config_Http_Https_Site extends Provision_Config_Http_Site {
public $template = 'vhost_https.tpl.php';
public $disabled_template = 'vhost_https_disabled.tpl.php';
public $https_cert_ok = TRUE;
public $description = 'encrypted virtual host configuration';
function write() {
if ($this->https_enabled && $this->https_key && !drush_get_error()) {
$path = dirname($this->data['https_cert']);
provision_file()
->create_dir($path, dt("HTTPS Certificate directory for %key on %server", array(
'%key' => $this->https_key,
'%server' => $this->data['server']->remote_host,
)), 0700);
if (!provision_file()
->copy($this->data['https_cert_source'], $this->data['https_cert'])
->status()) {
if (drush_get_option('hosting_https_fail_task_if_certificate_fails', FALSE)) {
drush_set_error('HTTPS_CERT_COPY_FAIL', dt('failed to copy HTTPS certificate in place'));
}
else {
drush_log(dt('failed to copy HTTPS certificate in place'), 'warning');
}
$this->https_cert_ok = FALSE;
}
if (!provision_file()
->copy($this->data['https_cert_key_source'], $this->data['https_cert_key'])
->status()) {
if (drush_get_option('hosting_https_fail_task_if_certificate_fails', FALSE)) {
drush_set_error('HTTPS_KEY_COPY_FAIL', dt('failed to copy HTTPS key in place'));
}
else {
drush_log(dt('failed to copy HTTPS key in place'), 'warning');
}
$this->https_cert_ok = FALSE;
}
if (!empty($this->data['https_chain_cert_source'])) {
if (!provision_file()
->copy($this->data['https_chain_cert_source'], $this->data['https_chain_cert'])
->status()) {
if (drush_get_option('hosting_https_fail_task_if_certificate_fails', FALSE)) {
drush_set_error('HTTPS_CHAIN_COPY_FAIL', dt('failed to copy HTTPS certficate chain in place'));
}
else {
drush_log(dt('failed to copy HTTPS certficate chain in place'), 'warning');
}
$this->https_cert_ok = FALSE;
}
}
if ($this->https_cert_ok == FALSE) {
$this->data['ssl_redirection'] = FALSE;
}
$this->data['server']
->sync($path);
}
parent::write();
}
function unlink() {
parent::unlink();
if ($this->https_enabled) {
}
}
}