system_performance_settings()Form builder; Configure site performance settings.
modules/system/system.admin.inc, line 1611
<?php
function system_performance_settings() {
drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
$form['clear_cache'] = array(
'#type' => 'fieldset',
'#title' => t('Clear cache'),
);
$form['clear_cache']['clear'] = array(
'#type' => 'submit',
'#value' => t('Clear all caches'),
'#submit' => array('system_clear_cache_submit'),
);
$form['caching'] = array(
'#type' => 'fieldset',
'#title' => t('Caching'),
);
$cache = variable_get('cache', CACHE_DISABLED);
$form['caching']['cache'] = array(
'#type' => 'radios',
'#title' => t('Page cache for anonymous users'),
'#default_value' => $cache,
'#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended)')),
);
$period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 86400), 'format_interval');
$period[0] = '<' . t('none') . '>';
$form['caching']['cache_lifetime'] = array(
'#type' => 'select',
'#title' => t('Minimum cache lifetime'),
'#default_value' => variable_get('cache_lifetime', 0),
'#options' => $period,
'#description' => t('The minimum amount of time that will elapse before the caches are recreated.')
);
$directory = 'public://';
$is_writable = is_dir($directory) && is_writable($directory);
$disabled = !$is_writable;
$disabled_message = '';
if(!$is_writable) {
$disabled_message = ' ' . t('<strong class="error">Set up the <a href="!file-system">public files directory</a> to make these optimizations available.</strong>', array('!file-system' => url('admin/config/media/file-system')));
}
$form['bandwidth_optimization'] = array(
'#type' => 'fieldset',
'#title' => t('Bandwidth optimization'),
'#description' => t('External resources can be optimized automatically, which can reduce both the size and number of requests made to your website.') . $disabled_message,
);
$js_hide = $cache == CACHE_DISABLED ? ' class="js-hide"' : '';
$form['bandwidth_optimization']['page_compression'] = array(
'#type' => 'checkbox',
'#title' => t('Compress cached pages.'),
'#default_value' => variable_get('page_compression', TRUE),
'#prefix' => '<div id="page-compression-wrapper"' . $js_hide . '>',
'#suffix' => '</div>',
);
$form['bandwidth_optimization']['preprocess_css'] = array(
'#type' => 'checkbox',
'#title' => t('Aggregate and compress CSS files into one file.'),
'#default_value' => intval(variable_get('preprocess_css', 0) && $is_writable),
'#disabled' => $disabled,
);
$form['bandwidth_optimization']['preprocess_js'] = array(
'#type' => 'checkbox',
'#title' => t('Aggregate JavaScript files into one file.'),
'#default_value' => intval(variable_get('preprocess_js', 0) && $is_writable),
'#disabled' => $disabled,
);
$form['#submit'][] = 'drupal_clear_css_cache';
$form['#submit'][] = 'drupal_clear_js_cache';
return system_settings_form($form, FALSE);
}
?>