You are here

function drush_prod_check_prod_mode in Production check & Production monitor 7

Same name and namespace in other branches
  1. 6 prod_check.drush.inc \drush_prod_check_prod_mode()

Switch to production mode.

1 string reference to 'drush_prod_check_prod_mode'
prod_check_drush_command in ./prod_check.drush.inc
Implementation of hook_drush_command().

File

./prod_check.drush.inc, line 74

Code

function drush_prod_check_prod_mode() {
  $options = array();

  // Ask extra input when the --config option is used.
  if (drush_get_option('config', FALSE)) {
    $options['site_mail'] = drush_prompt(dt('Site e-mail address'));
    if (module_exists('webform')) {
      $options['webform_default_from_address'] = drush_prompt(dt('Webform default from e-mail address'));
    }
    if (module_exists('googleanalytics')) {
      $options['googleanalytics_account'] = drush_prompt(dt('Google Analytics Web Property ID'));
    }
    $options['block_cache'] = drush_confirm(dt('Enable Block cache'));
    if (module_exists('dblog')) {
      $options['dblog'] = drush_confirm(dt('Disable Database logging'));
    }
    $options['nagios'] = drush_confirm(dt('Enable Nagios monitoring contrib module'));
  }

  // Adjust settings.
  module_load_include('inc', 'prod_check', 'includes/prod_check.admin');
  $variables = prod_check_prod_mode_settings($options);
  drush_print(dt('The following settings have been changed: !variables.', array(
    '!variables' => implode(', ', array_keys($variables)),
  )));

  // Enable / disable modules.
  $modules = prod_check_prod_mode_modules($options);
  if (!empty($modules['disable'])) {
    drush_print(dt('The following modules have been disabled: !modules.', array(
      '!modules' => implode(', ', $modules['disable']),
    )));
  }
  if (!empty($modules['enable'])) {
    drush_print(dt('The following modules have been enabled: !modules.', array(
      '!modules' => implode(', ', $modules['enable']),
    )));
  }
}