Commit e3c4a3d4 authored by Jon Pugh's avatar Jon Pugh

Merge branch '7.x-3.x' of git.drupal.org:project/provision into 2960237-sync-alter

parents 6bed7757 a902fff3
<?php
/**
* @file
* Provides the Provision_Config_Drupal_Services class.
*/
class Provision_Config_Drupal_Services extends Provision_Config {
public $template = 'aegir.services.tpl.php';
public $description = 'Drupal aegir.services.yml file';
protected $mode = 0440;
function filename() {
return $this->site_path . '/aegir.services.yml';
}
function process() {
$this->version = provision_version();
$this->cookie_domain = $this->getCookieDomain();
$this->group = $this->platform->server->web_group;
}
/**
* Extract our cookie domain from the URI.
*/
protected function getCookieDomain() {
$uri = explode('.', $this->uri);
# Leave base domain; only strip out subdomains.
if (count($uri) > 2) {
$uri[0] = '';
}
return implode('.', $uri);
}
}
---
# This file was automatically generated by Aegir <?php print $this->version; ?>
# on <?php print date('r'); ?>.
parameters:
session.storage.options:
cookie_domain: '<?php print $this->cookie_domain; ?>'
......@@ -160,7 +160,6 @@ if (isset($_SERVER['db_name'])) {
/**
* Load services definition file.
*/
$settings['container_yamls'][] = __DIR__ . '/aegir.services.yml';
$settings['container_yamls'][] = __DIR__ . '/services.yml';
/**
......
......@@ -25,6 +25,10 @@ function drush_provision_drupal_provision_install_validate() {
drush_log(dt('Forcing reinstall...'), 'ok');
// Drop the database if we can figure out what it is.
// If last install failed, the database and the site folder is deleted.
if (file_exists(d()->site_path . '/drushrc.php')) {
// Load the current database name from drushrc.php.
// I cannot find another way to find the current db_name!
require_once(d()->site_path . '/drushrc.php');
......@@ -36,6 +40,7 @@ function drush_provision_drupal_provision_install_validate() {
'@database' => $old_db_name,
)), 'ok');
}
}
// Destroy site_path.
if (file_exists(d()->site_path)) {
......@@ -46,7 +51,9 @@ function drush_provision_drupal_provision_install_validate() {
// Check again if site does not exist after the forced reinstall.
if (_provision_drupal_site_exists()) {
return drush_set_error('PROVISION_SITE_INSTALLED');
return drush_set_error('PROVISION_SITE_INSTALLED', dt('The file !file still exists. Provision was unable to delete it.', array(
'!file' => d()->site_path . '/settings.php',
)));
}
}
}
......
......@@ -170,12 +170,8 @@ function provision_drupal_fetch_site($alias = NULL) {
* Generate a settings file for the site.
*/
function _provision_drupal_create_settings_file() {
$name = d()->name;
$context = drush_get_context('site');
$settings = new Provision_Config_Drupal_Settings($name, $context);
$settings->write();
$services = new Provision_Config_Drupal_Services($name, $context);
$services->write();
$config = new Provision_Config_Drupal_Settings(d()->name, drush_get_context('site'));
$config->write();
}
/**
......
......@@ -178,5 +178,14 @@ function drush_provision_drupal_post_provision_verify() {
_provision_client_create_symlink();
drush_include_engine('drupal', 'cron_key');
# Cleanup useless `aegir.services.yml` files.
# See: https://www.drupal.org/project/provision/issues/3066538
$path = d()->site_path . '/aegir.services.yml';
if (provision_file()->exists($path)->status()) {
provision_file()->unlink($path)
->succeed('Cleaned up unused Aegir services.yml file.')
->fail('Failed to clean up unused Aegir services.yml file.', 'PROVISION_DELETE_AEGIR_SERVICES_YML_FAILED');
}
}
}
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