Commit fa085659 authored by helmo's avatar helmo

Issue #2819021 by colan, memtkmcc: Template cleanup

parent f8545ace
......@@ -15,32 +15,20 @@ class Provision_Config_Drupal_Settings extends Provision_Config {
}
function process() {
if (drush_drupal_major_version() >= 7) {
$this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type'];
$this->data['file_directory_path_var'] = 'file_public_path';
$this->data['file_directory_temp_var'] = 'file_temporary_path';
$this->data['file_directory_private_var'] = 'file_private_path';
$this->data['drupal_hash_salt_var'] = 'empty';
$this->data['utf8mb4_is_configurable'] = version_compare(drush_drupal_version(), '7.50', '>=');
$this->data['utf8mb4_is_supported'] = $this->db_server->utf8mb4_is_supported;
}
else {
$this->data['file_directory_path_var'] = 'file_directory_path';
$this->data['file_directory_temp_var'] = 'file_directory_temp';
}
if (drush_drupal_major_version() >= 8) {
$this->template = 'provision_drupal_settings_8.tpl.php';
$this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type'];
$this->data['utf8mb4_is_configurable'] = TRUE;
$this->data['utf8mb4_is_supported'] = $this->db_server->utf8mb4_is_supported;
$drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
require_once $drupal_root . '/core/lib/Drupal/Component/Utility/Crypt.php';
$this->data['drupal_hash_salt_var'] = Drupal\Component\Utility\Crypt::randomBytesBase64(55);
$this->data['config_directories_active_var'] = 'config_directories_active';
$this->data['config_directories_sync_var'] = 'config_directories_sync';
}
elseif (drush_drupal_major_version() == 7) {
$this->template = 'provision_drupal_settings_7.tpl.php';
$this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type'];
$this->data['utf8mb4_is_configurable'] = version_compare(drush_drupal_version(), '7.50', '>=');
$this->data['utf8mb4_is_supported'] = $this->db_server->utf8mb4_is_supported;
}
elseif (drush_drupal_major_version() <= 6) {
$this->template = 'provision_drupal_settings_6.tpl.php';
......
......@@ -138,14 +138,8 @@ if (isset($_SERVER['db_name'])) {
global $conf;
$conf['install_profile'] = '<?php print $this->profile ?>';
$conf['<?php print $file_directory_path_var ?>'] = 'sites/<?php print $this->uri ?>/files';
$conf['<?php print $file_directory_temp_var ?>'] = 'sites/<?php print $this->uri ?>/private/temp';
<?php if (isset($file_directory_private_var)): ?>
$conf['<?php print $file_directory_private_var ?>'] = 'sites/<?php print $this->uri ?>/private/files';
<?php endif; ?>
<?php if (isset($drupal_hash_salt_var)): ?>
$drupal_hash_salt = '';
<?php endif; ?>
$conf['file_directory_path'] = 'sites/<?php print $this->uri ?>/files';
$conf['file_directory_temp'] = 'sites/<?php print $this->uri ?>/private/temp';
$conf['clean_url'] = 1;
$conf['aegir_api'] = <?php print !$this->backup_in_progress ? $this->api_version : 0 ?>;
$conf['allow_authorize_operations'] = FALSE;
......
......@@ -136,14 +136,10 @@ if (isset($_SERVER['db_name'])) {
global $conf;
$conf['install_profile'] = '<?php print $this->profile ?>';
$conf['<?php print $file_directory_path_var ?>'] = 'sites/<?php print $this->uri ?>/files';
$conf['<?php print $file_directory_temp_var ?>'] = 'sites/<?php print $this->uri ?>/private/temp';
<?php if (isset($file_directory_private_var)): ?>
$conf['<?php print $file_directory_private_var ?>'] = 'sites/<?php print $this->uri ?>/private/files';
<?php endif; ?>
<?php if (isset($drupal_hash_salt_var)): ?>
$conf['file_public_path'] = 'sites/<?php print $this->uri ?>/files';
$conf['file_private_path'] = 'sites/<?php print $this->uri ?>/private/files';
$conf['file_temporary_path'] = 'sites/<?php print $this->uri ?>/private/temp';
$drupal_hash_salt = '';
<?php endif; ?>
$conf['clean_url'] = 1;
$conf['aegir_api'] = <?php print !$this->backup_in_progress ? $this->api_version : 0 ?>;
$conf['allow_authorize_operations'] = FALSE;
......
......@@ -48,7 +48,10 @@ if (isset($_SERVER['db_name'])) {
* should probably be fixed in Drush.
*/
'port' => (string) $_SERVER['db_port'],
<?php if ($utf8mb4_is_configurable && $utf8mb4_is_supported): ?>
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
<?php endif; ?>
);
$db_url['default'] = $_SERVER['db_type'] . '://' . $_SERVER['db_user'] . ':' . $_SERVER['db_passwd'] . '@' . $_SERVER['db_host'] . ':' . $_SERVER['db_port'] . '/' . $_SERVER['db_name'];
}
......@@ -131,20 +134,11 @@ if (isset($_SERVER['db_name'])) {
umask(0002);
$settings['install_profile'] = '<?php print $this->profile ?>';
$settings['<?php print $file_directory_path_var ?>'] = 'sites/<?php print $this->uri ?>/files';
$settings['<?php print $file_directory_temp_var ?>'] = 'sites/<?php print $this->uri ?>/private/temp';
<?php if (isset($file_directory_private_var)): ?>
$settings['<?php print $file_directory_private_var ?>'] = 'sites/<?php print $this->uri ?>/private/files';
<?php endif; ?>
<?php if (isset($drupal_hash_salt_var)): ?>
$settings['file_public_path'] = 'sites/<?php print $this->uri ?>/files';
$settings['file_private_path'] = 'sites/<?php print $this->uri ?>/private/files';
$config['system.file']['path']['temporary'] = 'sites/<?php print $this->uri ?>/private/temp';
$config_directories[CONFIG_SYNC_DIRECTORY] = 'sites/<?php print $this->uri ?>/private/config/sync';
$settings['hash_salt'] = '<?php print $drupal_hash_salt_var ?>';
<?php endif; ?>
<?php if (isset($config_directories_active_var)): ?>
$config_directories['active'] = 'sites/<?php print $this->uri ?>/private/config/active';
<?php endif; ?>
<?php if (isset($config_directories_sync_var)): ?>
$config_directories['sync'] = 'sites/<?php print $this->uri ?>/private/config/sync';
<?php endif; ?>
$settings['aegir_api'] = <?php print !$this->backup_in_progress ? $this->api_version : 0 ?>;
$settings['allow_authorize_operations'] = FALSE;
......
......@@ -242,9 +242,6 @@ function _provision_drupal_create_directories($url = NULL) {
$mkdir["sites/$url/private/config"] = 02770;
$chgrp["sites/$url/private/config"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/config/active"] = 02770;
$chgrp["sites/$url/private/config/active"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/config/sync"] = 02770;
$chgrp["sites/$url/private/config/sync"] = d('@server_master')->web_group;
}
......@@ -267,7 +264,6 @@ function _provision_drupal_create_directories($url = NULL) {
"sites/$url/files/styles",
"sites/$url/files/private",
"sites/$url/private/config",
"sites/$url/private/config/active",
"sites/$url/private/config/sync"
);
......
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