Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
trigger_action_purge_squid_cache.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/general_occasional.inc';
19 require_once SQ_CORE_PACKAGE_PATH.'/system/triggers/trigger_action/trigger_action.inc';
20 
33 {
34 
35 
45  function __construct($assetid=0)
46  {
47  parent::__construct($assetid);
48 
49  }//end constructor
50 
51 
62  public static function execute($settings, &$state)
63  {
64  if (empty($state['assetid'])) return FALSE;
65  $cascade = array_get_index($settings, 'cascade_clear_cache', FALSE);
66 
67  $vars = Array(
68  'assetid' => $state['assetid'],
69  'cascade' => $cascade,
70  'repopulate' => FALSE,
71  );
72  $hh =& $GLOBALS['SQ_SYSTEM']->getHipoHerder();
73  $status_errors = $hh->freestyleHipo('hipo_job_tool_clear_squid_cache', $vars, SQ_PACKAGES_PATH.'/squid/hipo_jobs');
74  if (!empty($status_errors)) return FALSE;
75 
76  return $vars;
77 
78  }//end execute()
79 
80 
91  public static function getInterface($settings, $prefix, $write_access=FALSE)
92  {
93  $settings['cascade_clear_cache'] = array_get_index($settings, 'cascade_clear_cache', FALSE);
94 
95  ob_start();
96 
97  echo translate('cascade_question').' ';
98  if ($write_access) {
99  check_box($prefix.'[cascade_clear_cache]', 1, $settings['cascade_clear_cache']);
100  } else {
101  echo '<img src="'.sq_web_path('lib').'/web/images/'.($settings['cascade_clear_cache'] ? 'tick' : 'cross').'.gif" alt="'.($settings['cascade_clear_cache'] ? translate('yes') : translate('no')).'" /> ';
102  }
103  echo "</br>";
104  echo translate('squid_tool_cascade_note');
105  echo "</br>";
106  echo "</br>";
107  echo translate('squid_tool_hostname_note');
108 
109  return ob_get_clean();
110 
111  }//end getInterface()
112 
113 
125  public static function processInterface(&$settings, $request_data)
126  {
127  $settings['cascade_clear_cache'] = array_get_index($request_data, 'cascade_clear_cache', FALSE);
128 
129  return FALSE;
130 
131  }//end processInterface()
132 
133 
134 }//end class
135 
136 ?>