Skip to content

Instantly share code, notes, and snippets.

@Jaesin
Last active November 13, 2017 22:41
Show Gist options
  • Save Jaesin/fb0696f2d0b2bc83cf79 to your computer and use it in GitHub Desktop.
Save Jaesin/fb0696f2d0b2bc83cf79 to your computer and use it in GitHub Desktop.
Some settings.php options
<?php
/**
* @file
* Some possible additions to the settings.php file or the settings.local.php file.
*/
$databases = ['default' => ['default' => [
'database' => 'db',
'username' => 'user',
'password' => 'pwd',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
]]];
// Environment Indicator settings.
$conf['environment_indicator_overwrite'] = TRUE;
$conf['environment_indicator_overwritten_name'] = 'Local';
$conf['environment_indicator_overwritten_color'] = '#707873';
$conf['environment_indicator_overwritten_text_color'] = '#ffffff';
$conf['environment_indicator_overwritten_position'] = 'top';
$conf['environment_indicator_overwritten_fixed'] = FALSE;
// Force file paths.
$conf['file_public_path'] = 'sites/default/files';
$conf['file_private_path'] = 'sites/default/files/private';
$conf['file_temporary_path'] = '/tmp';
// Turn off js and css aggregation.
$conf['preprocess_css'] = FALSE;
$conf['preprocess_js'] = FALSE;
// Show template files in HTML. See: https://www.drupal.org/docs/7/theming/template-theme-hook-suggestions
$conf['theme_debug'] = TRUE;
/**
* Disable cron.
*/
$conf['cron_safe_threshold'] = 0;
// Make sure you have lots of memory.
ini_set('memory_limit','500M');
// Some things take a really long time.
set_time_limit ( 1000 );
// Show all errors.
error_reporting(E_ALL);
ini_set('display_errors', '1');
// Log mail instead of sending (Requires the devel module).
$conf['mail_system'] = array(
'default-system' => 'DevelMailLog',
);
/**
* Include a local settings file if it exists.
*/
$local_settings = dirname(__FILE__) . '/settings.local.php';
if (file_exists($local_settings)) {
include $local_settings;
}
/**
* Disable secure pages for local development.
*/
$conf['securepages_enable'] = 0;
/**
* Disable shield for local development.
*/
$conf['shield_user'] = '';
// disable cron (D7):
$conf['cron_safe_threshold'] = 0;
// Stage file proxy settings (d7):
$conf['stage_file_proxy_origin'] = 'http://example.com';
// Suppress caching
if (!class_exists('DrupalFakeCache')) {
$conf['cache_backends'][] = 'includes/cache-install.inc';
}
// Default to throwing away cache data
$conf['cache_default_class'] = 'DrupalFakeCache';
// Rely on the DB cache for form caching - otherwise forms fail.
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
// Display errors
$conf['error_level'] = ERROR_REPORTING_DISPLAY_ALL;
<?php
/**
* @file
* Some possible additions to the settings.php file or the settings.local.php file for Drupal 8.
*/
// Force file paths.
$settings['file_public_path'] = 'sites/default/files';
$settings['file_private_path'] = 'sites/default/files/private';
$config['system.file']['path']['temporary'] = '/tmp';
// Turn off js and css aggregation in Drupal 8.
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
// User development serices.
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
// Disables render cache.
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
// Allow local site.
$settings['trusted_host_patterns'] = ['example.local'];
// Set the hash salt.
$settings['hash_salt'] = '¯\_(ツ)_/¯';
/**
* Log local mail instead of sending it.
*
* Use `\Drupal::state()->get('system.test_mail_collector');` to get the mail log.
*/
$config['system.mail']['interface']['default'] = 'test_mail_collector';
// Disable cron in settings.php for D8.
$config['automated_cron.settings']['interval'] = 0;
$config['system.site']['name'] = 'My Drupal site';
$config['system.theme']['default'] = 'stark';
$config['user.settings']['anonymous'] = 'Visitor';
// Stage file proxy settings:
$config['stage_file_proxy.settings']['origin'] = 'http://example.com';
// Display errors
$config['system.logging']['error_level'] = ERROR_REPORTING_DISPLAY_VERBOSE;
// Disable google analytics.
$config['google_analytics.settings']['account'] = '';
@zakiya
Copy link

zakiya commented Jan 13, 2017

# Control the depth of of a Kint statement in D8. Note that devel module must be in /contrib folder.
require_once DRUPAL_ROOT . '/modules/contrib/devel/kint/kint/Kint.class.php';
Kint::$maxLevels = 3;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment