You are here

function drush_cacheflush_drush_cacheflush in CacheFlush 7.3

Same name and namespace in other branches
  1. 8 modules/cacheflush_drush/cacheflush_drush.drush.inc \drush_cacheflush_drush_cacheflush()

Callback function for drush cacheflush.

Callback is called by using drush_hook_command() where hook is the name of the module (cacheflush_drush) and command is the name of the Drush command with all "-" characters converted to "_" characters.

Parameters

string|int $id: An optional argument.

File

modules/cacheflush_drush/cacheflush_drush.drush.inc, line 46
Cacheflush Drush implementation.

Code

function drush_cacheflush_drush_cacheflush($id = NULL) {
  module_load_include('inc', 'cacheflush', 'cacheflush.api');
  if (isset($id)) {
    if (is_numeric($id)) {
      drush_print(_cacheflush_clear_preset($id));
    }
    else {
      drush_print(t('Please provide the ID of the preset (numeric value) ex: "drush cf 1".'));
    }
  }
  else {
    drush_log(t('Preset list. Use "drush cf ID" to clear cache.'), 'ok');
    drush_print('');
    foreach (cacheflush_load_multiple(FALSE, array(
      'status' => 1,
    )) as $id => $entity) {
      drush_print('[' . $id . ']   :   ' . $entity->title);
    }
  }
}