Commit 24a9bfa7 authored by mikeytown2's avatar mikeytown2

#325813: add in 2 expiration settings & rework some functions.

parent e3743c85
<?php
// $Id$
/**
* @file
* Admin page callbacks for the boost module.
*/
/**
* Form builder; Configure boost settings.
*
* @ingroup forms
* @see system_settings_form()
*/
function boost_admin_expiration_settings() {
$form['boost_ignore_flush'] = array(
'#type' => 'checkbox',
'#title' => t('Ignore a cache flush command if cron issued the request.'),
'#default_value' => variable_get('boost_ignore_flush', BOOST_IGNORE_FLUSH),
'#description' => t(''),
);
$form['boost_expire_cron'] = array(
'#type' => 'checkbox',
'#title' => t('Remove old cache files on cron.'),
'#default_value' => variable_get('boost_expire_cron', BOOST_EXPIRE_CRON),
'#description' => t(''),
);
return system_settings_form($form);
}
......@@ -50,7 +50,7 @@ function boost_admin_htaccess_settings() {
$form['htaccess'] = array(
'#type' => 'fieldset',
'#title' => t('Boost Apache .htaccess settings generation'),
'#description' => t('<a href="!link">Explanation of .htaccess variables</a> <br /><br /> <strong>Be sure to save the configuration and then go to the <a href="!rules">htaccess rules generation page</a> and copy the rules.</strong>', array('!link' => url('http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html'), '!rules' => url('admin/config/development/performance/boost/htaccess-generator'))),
'#description' => t('<a href="!link">Explanation of .htaccess variables</a> <br /><br /> <strong>Be sure to save the configuration and then go to the <a href="!rules">htaccess rules generation page</a> and copy the rules.</strong>', array('!link' => url('http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html'), '!rules' => url('admin/config/system/boost/htaccess/generator'))),
);
$form['htaccess']['boost_server_name_http_host'] = array(
'#type' => 'radios',
......
......@@ -14,6 +14,40 @@
*/
function boost_admin_settings() {
drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
$form['cacheability'] = array(
'#type' => 'fieldset',
'#title' => t('Boost cacheability settings'),
);
// See http://api.drupal.org/api/function/block_admin_configure/7
$access = user_access('use PHP for settings');
$options = array(
BLOCK_VISIBILITY_NOTLISTED => t('All pages except those listed'),
BLOCK_VISIBILITY_LISTED => t('Only the listed pages'),
);
$description = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
if (module_exists('php') && $access) {
$options += array(BLOCK_VISIBILITY_PHP => t('Pages on which this PHP code returns <code>TRUE</code> (experts only)'));
$title = t('Pages or PHP code');
$description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>'));
}
else {
$title = t('Pages');
}
$form['cacheability']['boost_cacheability_option'] = array(
'#type' => 'radios',
'#title' => t('Cache specific pages'),
'#options' => $options,
'#default_value' => variable_get('boost_cacheability_option', BLOCK_VISIBILITY_NOTLISTED),
);
$form['cacheability']['boost_cacheability_pages'] = array(
'#type' => 'textarea',
'#title' => '<span class="element-invisible">' . $title . '</span>',
'#default_value' => variable_get('boost_cacheability_pages', BOOST_CACHEABILITY_PAGES),
'#description' => $description,
);
$types = boost_get_storage_types();
$period = drupal_map_assoc(array(0, 60, 180, 300, 600, 900, 1800, 2700, 3600, 10800, 21600, 32400, 43200, 64800, 86400, 2*86400, 3*86400, 4*86400, 5*86400, 6*86400, 604800, 2*604800, 3*604800, 4*604800, 8*604800, 16*604800, 52*604800), 'format_interval');
......@@ -93,37 +127,5 @@ function boost_admin_settings() {
$form['cache_types'][$title]['#collapsed'] = $collapsed;
}
$form['cacheability'] = array(
'#type' => 'fieldset',
'#title' => t('Boost cacheability settings'),
);
// See http://api.drupal.org/api/function/block_admin_configure/7
$access = user_access('use PHP for settings');
$options = array(
BLOCK_VISIBILITY_NOTLISTED => t('All pages except those listed'),
BLOCK_VISIBILITY_LISTED => t('Only the listed pages'),
);
$description = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcard for every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
if (module_exists('php') && $access) {
$options += array(BLOCK_VISIBILITY_PHP => t('Pages on which this PHP code returns <code>TRUE</code> (experts only)'));
$title = t('Pages or PHP code');
$description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '<?php ?>'));
}
else {
$title = t('Pages');
}
$form['cacheability']['boost_cacheability_option'] = array(
'#type' => 'radios',
'#title' => t('Cache specific pages'),
'#options' => $options,
'#default_value' => variable_get('boost_cacheability_option', BLOCK_VISIBILITY_NOTLISTED),
);
$form['cacheability']['boost_cacheability_pages'] = array(
'#type' => 'textarea',
'#title' => '<span class="element-invisible">' . $title . '</span>',
'#default_value' => variable_get('boost_cacheability_pages', BOOST_CACHEABILITY_PAGES),
'#description' => $description,
);
return system_settings_form($form);
}
......@@ -5,4 +5,4 @@ package = Performance and scalability
core = 7.x
files[] = boost.module
files[] = boost.admin.inc
configure = admin/config/development/performance/boost
configure = admin/config/system/boost
......@@ -78,7 +78,7 @@ function boost_requirements($phase) {
$requirements['boost'] = array(
'title' => $t('Boost'),
'severity' => REQUIREMENT_OK,
'value' => $t('Boost installed correctly, should be working if properly <a href="@settings">configured</a>.', array('@settings' => url('admin/config/development/performance/boost'))),
'value' => $t('Boost installed correctly, should be working if properly <a href="@settings">configured</a>.', array('@settings' => url('admin/config/system/boost'))),
);
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment