DrupalDork.com was shut down on September 18, 2013. This is just a snapshot of the site as it appeared then.
            
          Local Settings Template         
                          
                  
                          
    
    
  
    
      
      
            Submitted by Brock  on Sun 22 Jan 2012, 3:22 pm     
  
  
    A couple months ago, I wrote about our strategy of using local settings files  here at Jackson River .
I was setting up a new development site on my machine the other day, and realized that I've been consulting that blog post a couple times a week to copy over bits of code that were missing from various dev sites. It seemed like a good idea to move it into a gist:
<?php
/**
 * @file
 * local.settings.php
 * 
 * This settings file is intended to contain settings specific to a local
 * development environment, by overriding options set in settings.php.
 * 
 * Include this file from your regular settings.php by including this at the
 * bottom:
 * 
 *   @include('local.settings.php');
 * 
 * Placing this at the very end of settings.php will allow you override all
 * options that are set there. Prefixing it with the @ suppresses warnings if
 * the local.settings.php file is missing, so you can commit this to your repo.
 */
// Toggle the use of memcache.
$_use_memcache = FALSE;
// Toggle the output of devel debugging/logging.
$_use_devel = FALSE;
// Path where all contrib modules can be found.
$_contrib_path = 'sites/all/modules/contrib';
// The name of the database. This will also be used as the memcache prefix.
$_db_name = 'dbname';
$db_url = 'mysqli://root:pass4Root!@localhost/' . $_db_name;
// Allow anyone to run update.php, so that you don't have to log in with uid=1
// to do so
$update_free_access = TRUE;
// Set error reporting level to ignore notices and deprecated warnings. These
// should be turned back on during development to clean up any code that
// generates them.
error_reporting(E_ALL & ~E_DEPRECATED);
// Note that these options can also be moved into index.php, so that errors
// that occur before settings.php is processed will also be reported.
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
// Prep the $conf array.
if (!is_array($conf)) {
  $conf = array();
}
// Save email messages to the log instead of sending them out. This is to
// prevent accidental email sends from a development site.
// Make sure you adjust this value if the Devel module is located elsewhere
$_smtp_library = $_contrib_path . '/devel/devel.module';
if (is_file($_smtp_library)) {
  $conf['smtp_library'] = $_smtp_library;
}
// Disable Secure Pages and Secure Site module functionality
$conf['securepages_enable'] = 0;
$conf['securesite_enabled'] = 0;
// Use a test payment gateway to prevent real transactions
$conf['uc_payment_credit_gateway'] = 'test_gateway';
// Lower the search indexing per cron run to prevent long cron runs
$conf['search_cron_limit'] = '10';
// Disable preprocessing of CSS and JS.
$conf['preprocess_css'] = 0;
$conf['preprocess_js'] = 0;
// Use environment indicator, if available.
$conf['environment_indicator_enabled'] = TRUE;
$conf['environment_indicator_text'] = 'LOCAL DEVELOPMENT';
$conf['environment_indicator_color'] = 'dark-red';
// Use memcache if available & enabled.
$_memcache_inc = $_contrib_path . '/memcache/memcache.inc';
if ($_use_memcache && is_file($_memcache_inc)) {
  // Configure memcache locally
  $conf['memcache_servers'] = array(
    'localhost:11211' => 'default',
  );
  $conf['memcache_bins'] = array(
    'cache' => 'default',
  );
  $conf['memcache_key_prefix'] = $_db_name;
  $conf['cache_inc'] = $_memcache_inc;
}
else {
  // Revert to Drupal core caching in case settings.php
  // is configured to use Memcache.
  $conf['cache_inc'] = 'includes/cache.inc';
}
// Devel settings
if ($_use_devel) {
  $conf['dev_query'] = 1;
  $conf['devel_query_display'] = 1;
  $conf['devel_execution'] = 5;
  $conf['devel_store_queries'] = 0;
  $conf['devel_store_random'] = 1;
  $conf['devel_xhprof_enabled'] = 0;
  $conf['devel_xhprof_directory'] =  "/var/www/xhprof";
  $conf['devel_xhprof_url'] =  "http://debianvm/xhprof/xhprof_html";
  $conf['devel_redirect_page'] = 0;
  $conf['devel_query_sort'] = "0";
}
  
 
And, since I use TextExpander as much as I can, I also made a snippet to grab the contents of this gist.
#!/usr/bin/php
<?php
// Make sure to set the Content dropdown to Shell Script in TextExpander
print file_get_contents('https://raw.github.com/gist/1633790/local.settings.php');  
 
In order for this to work, make sure you set the Content dropdown above the snippet content to use Shell Script, like this:
Now when I type "llocalsett", I get a mostly-ready local.settings.php to start with!
 
  
  
 
   
 
   
      
     
Add new comment