-
Notifications
You must be signed in to change notification settings - Fork 2
/
nexteuropa_varnish.rules.inc
43 lines (40 loc) · 1.11 KB
/
nexteuropa_varnish.rules.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @file
* Hooks and callbacks used by rules api.
*/
/**
* Implements hook_rules_action_info().
*/
function nexteuropa_varnish_rules_action_info() {
return array(
'nexteuropa_varnish_rules_action_flush' => array(
'label' => t('Varnish flush'),
'group' => t('Nexteuropa Varnish'),
'parameter' => array(
'entity' => array(
'type' => 'entity',
'label' => t("Entity"),
),
'string' => array(
'type' => 'text',
'label' => t('Regexp'),
'description' => t('Enter a value for a string that will be hashed using the md5 hash-algorithm.'),
),
),
),
);
}
/**
* Callback for rules action.
*
* @param object $wrapper
* Entity wrapper passed argument.
* @param string $string
* Regexp string argument.
*/
function nexteuropa_varnish_rules_action_flush($wrapper, $string) {
module_load_include('inc', 'nexteuropa_varnish', 'nexteuropa_varnish.rules.admin');
$regex = _nexteuropa_varnish_gather_expressions($string);
_nexteuropa_varnish_purge_paths(array($regex), 'admin/config/workflow/rules');
}