function prod_check_prod_mode_settings in Production check & Production monitor 6
Same name and namespace in other branches
- 7 includes/prod_check.admin.inc \prod_check_prod_mode_settings()
Helper function to adjust settings. Also used by Drush.
2 calls to prod_check_prod_mode_settings()
- drush_prod_check_prod_mode in ./
prod_check.drush.inc - Switch to production mode.
- prod_check_prod_mode_form_submit in includes/
prod_check.admin.inc - Setup site for production mode: submit.
File
- includes/
prod_check.admin.inc, line 657
Code
function prod_check_prod_mode_settings($options) {
$variables = array(
// Error messages to display.
'error_level' => ERROR_REPORTING_HIDE,
// Cache pages for anonymous users.
'cache' => 1,
// Aggregate and compress CSS files.
'preprocess_css' => 1,
// Aggregate JavaScript files.
'preprocess_js' => 1,
);
// No page compression when running Varnish.
if (!module_exists('varnish') && !module_exists('steroids')) {
// Compress cached pages.
$variables['page_compression'] = 1;
}
// Site e-mail address.
if (isset($options['site_mail']) && !empty($options['site_mail'])) {
$variables['site_mail'] = $options['site_mail'];
}
// Webform default from e-mail address.
if (isset($options['webform_default_from_address']) && !empty($options['webform_default_from_address'])) {
$variables['webform_default_from_address'] = $options['webform_default_from_address'];
}
// Google analytics account.
if (isset($options['googleanalytics_account']) && !empty($options['googleanalytics_account'])) {
$variables['googleanalytics_account'] = $options['googleanalytics_account'];
}
// Cache blocks.
if (isset($options['block_cache']) && !empty($options['block_cache'])) {
$variables['block_cache'] = 1;
}
// Set variables. Wanted to do this in one query, but that was impossible due
// to the fact that it is possible a variable does not exist in the database
// yet and still have a value. Damn that default value in variable_get()!
foreach ($variables as $variable => $value) {
variable_set($variable, $value);
}
// Clear caches like the system_performance_settings() form does.
drupal_clear_css_cache();
drupal_clear_js_cache();
// Instead of calling system_clear_page_cache_submit()
cache_clear_all('*', 'cache_page', TRUE);
return $variables;
}