function authcache_admin_config in Authenticated User Page Caching (Authcache) 7.2
Same name and namespace in other branches
- 6 authcache.admin.inc \authcache_admin_config()
- 7 authcache.admin.inc \authcache_admin_config()
Main Authcache configuration form.
1 string reference to 'authcache_admin_config'
- authcache_menu in ./
authcache.module - Implements hook_menu().
File
- ./
authcache.admin.inc, line 11 - Admin forms and pages.
Code
function authcache_admin_config($form, &$form_state) {
drupal_set_title(t('Authcache Configuration'));
$form['roles'] = array(
'#type' => 'fieldset',
'#title' => t('Authcache Roles'),
'#collapsible' => TRUE,
);
$form['roles']['authcache_roles'] = array(
'#title' => t('Enable caching for specified user roles'),
'#description' => t('If no roles are selected, Authcache page caching will not be enabled. Unchecked roles will never be cached.'),
'#type' => 'checkboxes',
'#options' => authcache_get_roles(TRUE),
'#default_value' => variable_get('authcache_roles', array()),
);
$form['key'] = array(
'#type' => 'fieldset',
'#title' => t('Key Management'),
'#collapsible' => TRUE,
);
$session_cookie_lifetime = (int) ini_get('session.cookie_lifetime');
if ($session_cookie_lifetime > 0) {
$session_period = format_interval($session_cookie_lifetime);
}
else {
$session_period = t('Temporary');
}
$session_period_option = t('Same as Session (@period)', array(
'@period' => $session_period,
));
// @ignore sniffer_array_array_longlinedeclaration
$durations = array(
0,
600,
3600,
10800,
43200,
86400,
259200,
604800,
1209600,
);
$form['key']['key_lifetime'] = array(
'#type' => 'authcache_duration_select',
'#title' => t('Key lifetime'),
'#default_value' => variable_get('authcache_key_lifetime'),
'#durations' => $durations,
'#empty_option' => $session_period_option,
'#empty_value' => 'session',
'#zero_duration' => t('Temporary'),
'#description' => t('Select <em>Temporary</em> if keys should last for one browser session (when using Cookies) or keys should be removed during cron runs.'),
);
$form['adv'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
);
$form['adv']['noajax'] = array(
'#type' => 'checkbox',
'#title' => t("Don't cache Drupal Ajax requests"),
'#default_value' => variable_get('authcache_noajax', 0),
'#description' => t('Note that most Ajax callbacks issued by Drupal core and contrib modules use POST requests. As a result they are not cacheable in the first place. A notable exception is the autocomplete callback.'),
);
$form['adv']['http200'] = array(
'#type' => 'checkbox',
'#title' => t('Only cache HTTP 200 OK pages (exclude 404, 403, etc)'),
'#default_value' => variable_get('authcache_http200', 0),
'#description' => t("It's recommended to cache all Drupal pages, though error response pages can be excluded if required."),
);
$form['adv']['su'] = array(
'#type' => 'checkbox',
'#title' => t('Allow caching for superuser (uid = 1)'),
'#default_value' => variable_get('authcache_su', 0),
'#description' => t('Specify whether pages should also be cached for the superuser.'),
);
$form['adv']['mimetype'] = array(
'#type' => 'textarea',
'#title' => t('Cacheable content-types'),
'#description' => t('Specify which content-types can be cached.'),
'#default_value' => variable_get('authcache_mimetype', AUTHCACHE_MIMETYPE_DEFAULT),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save & clear cached pages'),
);
// Status messages.
$modules = module_implements('authcache_backend_cache_save');
if (empty($modules)) {
drupal_set_message(t('No cache backend module enabled. See <a href="@url">README.txt</a>.', array(
'@url' => base_path() . drupal_get_path('module', 'authcache') . '/README.txt',
)), 'error');
}
if (!variable_get('page_compression', TRUE)) {
drupal_set_message(t('Note: Page compression is not enabled! It is strongly recommend that you <a href="@url">turn this setting on</a> through Drupal to allow for faster page response times.', array(
'@url' => url('admin/config/development/performance'),
)), 'warning');
}
return $form;
}