Skip to content
Snippets Groups Projects
Commit 8e108dd4 authored by Tim Steiner's avatar Tim Steiner
Browse files

[gh-167] Merging from testing into staging

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x/staging@815 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent 95b2e08f
No related branches found
No related tags found
No related merge requests found
; $Id$
name = UNL Varnish
description = Extends the Varnish module to do a few extra tasks.
package = UNL
dependencies[] = varnish
core = 7.x
version = "7.x-1.0-20110706"
files[] = unl_varnish.module
<?php
/**
* Modifies the system performance settings form to add a button to purge the varnish cache.
*/
function unl_varnish_form_system_performance_settings_alter(&$form, &$form_state, $form_id) {
$form['clear_cache']['#weight'] = -2;
$form['purge_varnish'] = array(
'#type' => 'fieldset',
'#title' => 'Purge Varnish',
'#access' => user_access('administer varnish'),
'#weight' => -1,
'varnish_path' => array(
'#type' => 'radios',
'#required' => TRUE,
'#options' => array(
'^/wdn' => 'Just WDN template files (/wdn)',
'^/' => 'Everything',
),
'#default_value' => '^/wdn',
),
'purge' => array(
'#type' => 'submit',
'#value' => 'Purge varnish cache',
'#submit' => array('unl_varnish_purge_submit'),
),
);
return $form;
}
/**
* Uses the varnish module to purge varnish at the requested path.
*/
function unl_varnish_purge_submit($form, &$form_state) {
$path = $form_state['values']['varnish_path'];
_varnish_terminal_run("purge.url $path");
drupal_set_message("Varnish purged paths matching $path.", 'status');
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment