#!/bin/bash
set -e

# Drush executable.
[[ $DRUSH && ${DRUSH-x} ]] || DRUSH=drush

echo "Generating sites/default/settings.php..."
cat > /home/travis/drupal/sites/default/settings.php <<EOF
<?php

/**
 * Access control for update.php script.
 */
\$update_free_access = FALSE;

/**
 * Salt for one-time login links and cancel links, form tokens, etc.
 */
\$drupal_hash_salt = '';

/**
 * PHP settings:
 */
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);
ini_set('session.gc_maxlifetime', 200000);
ini_set('session.cookie_lifetime', 2000000);

/**
 * Fast 404 pages:
 */
\$conf['404_fast_paths_exclude'] = '/\/(?:styles)\//';
\$conf['404_fast_paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i';
\$conf['404_fast_html'] = '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>';

// Database configuration.
\$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'drupal_patterns',
  'host' => '127.0.0.1',
  'username' => 'root',
  'password' => '',
  'prefix' => '',
);

// Use Devel to redirect SMTP to file.
\$conf['mail_system'] = array('default-system' => 'DevelMailLog');

EOF

echo "Setup finished. Please run the build script."

