Skip to content

Commit

Permalink
Merge pull request #938 from dan2k3k4/run-phpcbf
Browse files Browse the repository at this point in the history
Cleanup Drupal settings files with PHPCBF
  • Loading branch information
Schnitzel authored Mar 9, 2019
2 parents a3b84cc + 12842d9 commit c3f378c
Show file tree
Hide file tree
Showing 19 changed files with 234 additions and 212 deletions.
22 changes: 13 additions & 9 deletions docs/using_lagoon/drupal/drupal7-mariadb/drush/aliases.drushrc.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<?php
// Don't change anything here, it's magic!

/**
* @file
* Don't change anything here, it's magic!
*/

global $aliases_stub;
if (empty($aliases_stub)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'https://drush-alias.lagoon.amazeeio.cloud/aliases.drushrc.php.stub');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$aliases_stub = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'https://drush-alias.lagoon.amazeeio.cloud/aliases.drushrc.php.stub');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$aliases_stub = curl_exec($ch);
curl_close($ch);
}
eval($aliases_stub);
7 changes: 4 additions & 3 deletions docs/using_lagoon/drupal/drupal7-mariadb/drush/drushrc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* amazee.io drushrc.php file
Expand All @@ -7,8 +8,8 @@
* It contains some defaults that the amazee.io team suggests, please edit them as required.
*/

### Skip data for some tables during sql dumps and syncs
# These tables will be syncronized just as structure and not the data inside them, this makes syncing and dumping much faster
# In case you need these tables, call the 'sql-sync' or 'sql-dump' command with: --no-structure-tables-list
// Skip data for some tables during sql dumps and syncs
// These tables will be syncronized just as structure and not the data inside them, this makes syncing and dumping much faster
// In case you need these tables, call the 'sql-sync' or 'sql-dump' command with: --no-structure-tables-list.
$command_specific['sql-sync'] = array('structure-tables-list' => 'cache,cache_*,history,sessions,watchdog,feeds_log');
$command_specific['sql-dump'] = array('structure-tables-list' => 'cache,cache_*,history,sessions,watchdog,feeds_log');
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* Lagoon Drupal 7 all environment configuration file.
Expand All @@ -7,8 +8,8 @@
* It contains some defaults that the Lagoon team suggests, please edit them as required.
*/

// Minimum cache lifetime should be always 0, therefore no automatic cache purging
// Minimum cache lifetime should be always 0, therefore no automatic cache purging.
$conf['cache_lifetime'] = 0;

// Pages will be compressed by nginx, no need for Drupal to do that
// Pages will be compressed by nginx, no need for Drupal to do that.
$conf['page_compression'] = 0;
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* Lagoon Drupal 7 development environment configuration file.
Expand All @@ -7,25 +8,25 @@
* It contains some defaults that the Lagoon team suggests, please edit them as required.
*/

// Show all error messages on the site
// Show all error messages on the site.
$conf['error_level'] = 2;

// Anonymous caching disabled
// Anonymous caching disabled.
$conf['cache'] = 0;

// Block caching disabled
// Block caching disabled.
$conf['block_cache'] = 0;

// Expiration of cached pages to 0
// Expiration of cached pages to 0.
$conf['page_cache_maximum_age'] = 0;

// Aggregate and compress CSS files off
// Aggregate and compress CSS files off.
$conf['preprocess_css'] = 0;

// Aggregate JavaScript files off
// Aggregate JavaScript files off.
$conf['preprocess_js'] = 0;

// Stage file proxy URL from production URL
if(getenv('LAGOON_PRODUCTION_URL')){
// Stage file proxy URL from production URL.
if (getenv('LAGOON_PRODUCTION_URL')) {
$conf['stage_file_proxy_origin'] = getenv('LAGOON_PRODUCTION_URL');
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* Lagoon Drupal 7 production environment configuration file.
Expand All @@ -11,21 +12,21 @@
// Don't show any error messages on the site (will still be shown in watchdog)
$conf['error_level'] = 0;

// Anonymous caching enabled
// Anonymous caching enabled.
$conf['cache'] = 1;

// Block caching enabled
// Block caching enabled.
$conf['block_cache'] = 1;

// Expiration of cached pages on Varnish to 15 min
// Expiration of cached pages on Varnish to 15 min.
$conf['page_cache_maximum_age'] = 900;

// Aggregate and compress CSS files on
// Aggregate and compress CSS files on.
$conf['preprocess_css'] = 1;

// Aggregate JavaScript files on
// Aggregate JavaScript files on.
$conf['preprocess_js'] = 1;

// Disabling stage_file_proxy on production, with that the module can be enabled even on production
$conf['stage_file_proxy_origin'] = false;
$conf['stage_file_proxy_origin_dir'] = false;
// Disabling stage_file_proxy on production, with that the module can be enabled even on production.
$conf['stage_file_proxy_origin'] = FALSE;
$conf['stage_file_proxy_origin_dir'] = FALSE;
137 changes: 69 additions & 68 deletions docs/using_lagoon/drupal/drupal7-mariadb/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,83 +14,84 @@
* For settings only for the development environment (dev servers, docker).
* - settings.local.php
* For settings only for the local environment, this file will not be commited in GIT!
*
*/

### Lagoon Database connection
if (getenv('LAGOON')){
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => getenv('MARIADB_DATABASE') ?: 'drupal',
'username' => getenv('MARIADB_USERNAME') ?: 'drupal',
'password' => getenv('MARIADB_PASSWORD') ?: 'drupal',
'host' => getenv('MARIADB_HOST') ?: 'mariadb',
'port' => 3306,
'prefix' => '',
);
}

### Lagoon Solr connection
// WARNING: you have to create a search_api server having "solr" machine name at
// /admin/config/search/search-api/add-server to make this work.
// Also you need to have the search_api_override module installed and enabled - https://www.drupal.org/project/search_api_override
if (getenv('LAGOON')){
// Override search API server settings fetched from default configuration.
$conf['search_api_override_mode'] = 'load';
$conf['search_api_override_servers']['solr']['name'] = 'Lagoon Solr - Environment:' . getenv('LAGOON_PROJECT');
$conf['search_api_override_servers']['solr']['options']['host'] = getenv('SOLR_HOST') ?: 'solr';
$conf['search_api_override_servers']['solr']['options']['port'] = 8983;
$conf['search_api_override_servers']['solr']['options']['path'] = '/solr/' . getenv('SOLR_CORE') ?: 'drupal';
$conf['search_api_override_servers']['solr']['options']['http_user'] = (getenv('SOLR_USER') ?: '');
$conf['search_api_override_servers']['solr']['options']['http_pass'] = (getenv('SOLR_PASSWORD') ?: '');
$conf['search_api_override_servers']['solr']['options']['excerpt'] = 0;
$conf['search_api_override_servers']['solr']['options']['retrieve_data'] = 0;
$conf['search_api_override_servers']['solr']['options']['highlight_data'] = 0;
$conf['search_api_override_servers']['solr']['options']['http_method'] = 'POST';
// Lagoon Database connection.
if (getenv('LAGOON')) {
$databases['default']['default'] = array(
'driver' => 'mysql',
'database' => getenv('MARIADB_DATABASE') ?: 'drupal',
'username' => getenv('MARIADB_USERNAME') ?: 'drupal',
'password' => getenv('MARIADB_PASSWORD') ?: 'drupal',
'host' => getenv('MARIADB_HOST') ?: 'mariadb',
'port' => 3306,
'prefix' => '',
);
}

### Lagoon Varnish & reverse proxy settings
if (getenv('LAGOON')) {
$varnish_control_port = getenv('VARNISH_CONTROL_PORT') ?: '6082';
$varnish_hosts = explode(',', getenv('VARNISH_HOSTS') ?: 'varnish');
array_walk($varnish_hosts, function(&$value, $key) use ($varnish_control_port) { $value .= ":$varnish_control_port"; });
// Lagoon Solr connection
// WARNING: you have to create a search_api server having "solr" machine name at
// /admin/config/search/search-api/add-server to make this work.
// Also you need to have the search_api_override module installed and enabled - https://www.drupal.org/project/search_api_override
if (getenv('LAGOON')) {
// Override search API server settings fetched from default configuration.
$conf['search_api_override_mode'] = 'load';
$conf['search_api_override_servers']['solr']['name'] = 'Lagoon Solr - Environment:' . getenv('LAGOON_PROJECT');
$conf['search_api_override_servers']['solr']['options']['host'] = getenv('SOLR_HOST') ?: 'solr';
$conf['search_api_override_servers']['solr']['options']['port'] = 8983;
$conf['search_api_override_servers']['solr']['options']['path'] = '/solr/' . getenv('SOLR_CORE') ?: 'drupal';
$conf['search_api_override_servers']['solr']['options']['http_user'] = (getenv('SOLR_USER') ?: '');
$conf['search_api_override_servers']['solr']['options']['http_pass'] = (getenv('SOLR_PASSWORD') ?: '');
$conf['search_api_override_servers']['solr']['options']['excerpt'] = 0;
$conf['search_api_override_servers']['solr']['options']['retrieve_data'] = 0;
$conf['search_api_override_servers']['solr']['options']['highlight_data'] = 0;
$conf['search_api_override_servers']['solr']['options']['http_method'] = 'POST';
}

$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array_merge(explode(',', getenv('VARNISH_HOSTS')), array('varnish'));
$conf['varnish_control_terminal'] = implode($varnish_hosts, " ");
$conf['varnish_control_key'] = getenv('VARNISH_SECRET') ?: 'lagoon_default_secret';
$conf['varnish_version'] = 4;
}
// Lagoon Varnish & reverse proxy settings.
if (getenv('LAGOON')) {
$varnish_control_port = getenv('VARNISH_CONTROL_PORT') ?: '6082';
$varnish_hosts = explode(',', getenv('VARNISH_HOSTS') ?: 'varnish');
array_walk($varnish_hosts, function (&$value, $key) use ($varnish_control_port) {
$value .= ":$varnish_control_port";
});

### Base URL
if (getenv('LAGOON_ROUTE')) {
$proto = isset($_SERVER["HTTP_X_FORWARDED_PROTO"]) ? $_SERVER["HTTP_X_FORWARDED_PROTO"] : 'http';
$base_url = $proto . "://" . $_SERVER["HTTP_HOST"];
}
$conf['reverse_proxy'] = TRUE;
$conf['reverse_proxy_addresses'] = array_merge(explode(',', getenv('VARNISH_HOSTS')), array('varnish'));
$conf['varnish_control_terminal'] = implode($varnish_hosts, " ");
$conf['varnish_control_key'] = getenv('VARNISH_SECRET') ?: 'lagoon_default_secret';
$conf['varnish_version'] = 4;
}

### Temp directory
if (getenv('TMP')) {
$conf['file_temporary_path'] = getenv('TMP');
}
// Base URL.
if (getenv('LAGOON_ROUTE')) {
$proto = isset($_SERVER["HTTP_X_FORWARDED_PROTO"]) ? $_SERVER["HTTP_X_FORWARDED_PROTO"] : 'http';
$base_url = $proto . "://" . $_SERVER["HTTP_HOST"];
}

### Hash Salt
if (getenv('LAGOON')){
$drupal_hash_salt = hash('sha256', getenv('LAGOON_PROJECT'));
}
// Temp directory.
if (getenv('TMP')) {
$conf['file_temporary_path'] = getenv('TMP');
}

// Loading settings for all environment types.
if (file_exists(__DIR__ . '/all.settings.php')) {
include __DIR__ . '/all.settings.php';
}
// Hash Salt.
if (getenv('LAGOON')) {
$drupal_hash_salt = hash('sha256', getenv('LAGOON_PROJECT'));
}

// Environment specific settings files.
if (getenv('LAGOON_ENVIRONMENT_TYPE')){
if (file_exists(__DIR__ . '/' . getenv('LAGOON_ENVIRONMENT_TYPE') . '.settings.php')) {
include __DIR__ . '/' . getenv('LAGOON_ENVIRONMENT_TYPE') . '.settings.php';
// Loading settings for all environment types.
if (file_exists(__DIR__ . '/all.settings.php')) {
include __DIR__ . '/all.settings.php';
}
}

// Last: this servers specific settings files.
if (file_exists(__DIR__ . '/settings.local.php')) {
include __DIR__ . '/settings.local.php';
}
// Environment specific settings files.
if (getenv('LAGOON_ENVIRONMENT_TYPE')) {
if (file_exists(__DIR__ . '/' . getenv('LAGOON_ENVIRONMENT_TYPE') . '.settings.php')) {
include __DIR__ . '/' . getenv('LAGOON_ENVIRONMENT_TYPE') . '.settings.php';
}
}

// Last: this servers specific settings files.
if (file_exists(__DIR__ . '/settings.local.php')) {
include __DIR__ . '/settings.local.php';
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
<?php
// Don't change anything here, it's magic!

/**
* @file
* Don't change anything here, it's magic!
*/

global $aliases_stub;
if (empty($aliases_stub)) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'https://drush-alias.lagoon.amazeeio.cloud/aliases.drushrc.php.stub');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$aliases_stub = curl_exec($ch);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, 'https://drush-alias.lagoon.amazeeio.cloud/aliases.drushrc.php.stub');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$aliases_stub = curl_exec($ch);
curl_close($ch);
}
eval($aliases_stub);
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php

/**
* @file
* Lagoon drushrc.php file
* Lagoon drushrc.php file.
*
* This file tells drush about the Lagoon environment
* It contains some defaults that the Lagoon team suggests, please edit them as required.
*/

### Skip data for some tables during sql dumps and syncs
# These tables will be syncronized just as structure and not the data inside them, this makes syncing and dumping much faster
# In case you need these tables, call the 'sql-sync' or 'sql-dump' command with: --no-structure-tables-list
// Skip data for some tables during sql dumps and syncs
// These tables will be syncronized just as structure and not the data inside them, this makes syncing and dumping much faster
// In case you need these tables, call the 'sql-sync' or 'sql-dump' command with: --no-structure-tables-list.
$command_specific['sql-sync'] = array('structure-tables-list' => 'cache,cache_*,history,sessions,watchdog,feeds_log');
$command_specific['sql-dump'] = array('structure-tables-list' => 'cache,cache_*,history,sessions,watchdog,feeds_log');
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* Lagoon Drupal 8 all environment configuration file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @file
* Lagoon Drupal 8 development environment configuration file.
Expand All @@ -8,22 +9,22 @@
* It contains some defaults that the Lagoon team suggests, please edit them as required.
*/

// Show all error messages on the site
// Show all error messages on the site.
$config['system.logging']['error_level'] = 'all';

// Disable Google Analytics from sending dev GA data.
// Disable Google Analytics from sending dev GA data.
$config['google_analytics.settings']['account'] = 'UA-XXXXXXXX-YY';

// Expiration of cached pages to 0
// Expiration of cached pages to 0.
$config['system.performance']['cache']['page']['max_age'] = 0;

// Aggregate CSS files off
// Aggregate CSS files off.
$config['system.performance']['css']['preprocess'] = 0;

// Aggregate JavaScript files off
// Aggregate JavaScript files off.
$config['system.performance']['js']['preprocess'] = 0;

// Stage file proxy URL from production URL
if (getenv('LAGOON_PRODUCTION_URL')){
// Stage file proxy URL from production URL.
if (getenv('LAGOON_PRODUCTION_URL')) {
$config['stage_file_proxy.settings']['origin'] = getenv('LAGOON_PRODUCTION_URL');
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

/**
* @file
* Lagoon Drupal 8 example settings.local.php file
* Lagoon Drupal 8 example settings.local.php file.
*
* This file will not be included and is just an example file.
* If you would like to use this file, copy it to the name 'settings.local.php' (this file will be exluded from Git)
*/

// Disable render caches, necessary for twig files to be reloaded on every page view
// Disable render caches, necessary for twig files to be reloaded on every page view.
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
Loading

0 comments on commit c3f378c

Please sign in to comment.