You are here

function cache_actions_rules_action_info in Cache Actions 7

Same name and namespace in other branches
  1. 6.2 cache_actions.rules.inc \cache_actions_rules_action_info()
  2. 6 cache_actions.rules.inc \cache_actions_rules_action_info()
  3. 7.2 cache_actions.rules.inc \cache_actions_rules_action_info()

Implementation of hook_rules_action_info().

File

./cache_actions.rules.inc, line 11
This file provides the rules integration for this module.

Code

function cache_actions_rules_action_info() {

  // Actions that works for everyone
  $actions = array(
    'cache_actions_action_clear_cache' => array(
      'label' => t('Clear cache bins'),
      'parameter' => array(
        'tables' => array(
          'type' => 'list<text>',
          'label' => t('Cache Bins'),
          'save' => TRUE,
          'options list' => '_cache_actions_get_cache_bins',
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_cache',
    ),
    'cache_actions_action_clear_cache_cid' => array(
      'label' => t('Clear a specific cache cid'),
      'parameter' => array(
        'bin' => array(
          'type' => 'text',
          'label' => t('Cache bin'),
          'description' => t('The cache table where the cid is'),
          'options list' => '_cache_actions_get_cache_bins',
          'restriction' => 'input',
          'save' => TRUE,
        ),
        'cid' => array(
          'type' => 'text',
          'label' => t('Cache key'),
          'description' => t('The key to clear'),
          'save' => TRUE,
        ),
        'wildcard' => array(
          'type' => 'boolean',
          'label' => t('Use wildcard'),
          'description' => t('Use wildcards. This means you will be clearing all cache keys that partially matches.'),
          'restriction' => 'input',
          'save' => TRUE,
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_cache_cid',
    ),
    'cache_actions_action_clear_css_js_cache' => array(
      'label' => t('Clear the css and js cache'),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_css_js_cache',
    ),
  );

  // If the Views module is available, then we can clear the cache of individual views.
  if (module_exists('views')) {
    $actions['cache_actions_action_clear_views_cache'] = array(
      'label' => t('Clear the cache for specific views'),
      'parameter' => array(
        'view' => array(
          'type' => 'list<text>',
          'label' => t('Views'),
          'description' => t('The cache of the selected views will be cleared.'),
          'options list' => '_cache_actions_get_views_list',
          'save' => TRUE,
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_views_cache',
    );
    $actions['cache_actions_action_clear_views_display_cache'] = array(
      'label' => t('Clear the cache for views displays'),
      'parameter' => array(
        'displays' => array(
          'type' => 'list<text>',
          'label' => t('Displays'),
          'description' => t('The cache of the selected displays will be cleared'),
          'options list' => '_cache_actions_get_views_displays',
          'restriction' => 'input',
          'save' => TRUE,
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_views_display_cache',
    );
  }

  // If the page manager module is available, then we can clear panels stuff.
  if (module_exists('page_manager')) {
    $actions['cache_actions_action_clear_panels_page_cache'] = array(
      'label' => t('Clear the cache for panel page variants'),
      'parameter' => array(
        'panel' => array(
          'type' => 'list<text>',
          'label' => t('Panel Variants'),
          'description' => t('The panel variant to invalidate.'),
        ),
        'options' => '_cache_actions_get_panels_handlers',
        'restriction' => 'input',
        'save' => TRUE,
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_panels_page_cache',
    );
    $actions['cache_actions_action_clear_panels_pane_cache'] = array(
      'label' => t('Clear the cache for panel page panes'),
      'parameter' => array(
        'panel' => array(
          'type' => 'text',
          'label' => t('Panel Page Variant'),
          'description' => t('Specify the panel page you want to clear.'),
          'options list' => '_cache_actions_get_page_variants',
          'restriction' => 'input',
          'save' => TRUE,
        ),
        'panes' => array(
          'type' => 'list<text>',
          'label' => t('Panes'),
          'description' => t('Specify the panes to invalidate here.'),
          'options list' => '_cache_actions_get_panes',
          'restriction' => 'input',
          'save' => TRUE,
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_panels_pane_cache',
    );
  }
  if (module_exists('panels_mini')) {
    $actions['cache_actions_action_clear_panels_mini_cache'] = array(
      'label' => t('Clear the cache for specific panes'),
      'parameter' => array(
        'panel' => array(
          'type' => 'list<text>',
          'label' => t('Mini Panel'),
          'description' => t('Specify the mini panel variants you want to invalidate.'),
          'options list' => '_cache_actions_get_mini_panels',
          'save' => TRUE,
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_panels_mini_cache',
    );
    $actions['cache_actions_action_clear_panels_mini_pane_cache'] = array(
      'label' => t('Clear the cache for mini panel panes'),
      'parameter' => array(
        'panel' => array(
          'type' => 'text',
          'label' => t('Panel page'),
          'description' => t('Specify the mini panel you want to clear.'),
          'options list' => '_cache_actions_get_mini_panels',
          'save' => TRUE,
          'restriction' => 'input',
        ),
        'panes' => array(
          'type' => 'list<text>',
          'label' => t('Panel panes'),
          'options list' => '_cache_actions_get_mini_panel_panes',
          'description' => t('Specify the mini panel panes you want to invalidate.'),
          'save' => TRUE,
          'restriction' => 'input',
        ),
      ),
      'group' => t('Cache Actions'),
      'base' => 'cache_actions_action_clear_panels_mini_pane_cache',
    );
  }

  /*
    // If varnish module is available, then we can clear specific varnish pages.
    if (module_exists('varnish')) {
   $actions['cache_actions_action_clear_varnish_page'] = array(
     'label' => t('Clear paths cached in varnish'),
     'arguments' => array(
       'paths' => array('type' => 'string', 'label' => t('Varnish paths'), 'description' => t('The cached paths')),
     ),
     'module' => 'Cache Actions',
   );

   $actions['cache_actions_action_clear_varnish_cache'] = array(
     'label' => t('Clear all paths cached in varnish for this site'),
     'module' => 'Cache Actions',
   );
    }
  */
  return $actions;
}