$type))); } if ($type) { drush_op($types[$type]); drush_log(dt("'!name' cache was cleared", array('!name' => $type)), 'success'); } else { $choice = drush_choice($types, 'Enter a number to choose which cache to clear.', '!key'); if ($choice !== FALSE) { call_user_func($types[$choice]); drush_log(dt("'!name' cache was cleared", array('!name' => $choice)), 'success'); } } break; } } function drush_cache_clear_types() { $types = array( 'all' => 'drupal_flush_all_caches', 'theme registry' => 'drush_cache_clear_theme_registry', 'menu' => 'menu_rebuild', 'css+js' => 'drush_cache_clear_css_js', 'block' => 'drush_cache_clear_block', 'module list' => 'drush_get_modules', 'theme list' => 'drush_get_themes', ); if (drush_drupal_major_version() >= 7) { $types['registry'] = 'registry_update'; } elseif (drush_drupal_major_version() == 6 && module_exists('autoload')) { // TODO: move this to autoload module. $types['registry'] = 'autoload_registry_update'; } if (count(module_implements('node_grants'))) { $types['nodeaccess'] = 'node_access_rebuild'; } // Include the appropriate environment engine, so callbacks can use core // version specific cache clearing functions directly. drush_include_engine('drupal', 'environment'); // Command files may customize $types as desired. drush_command_invoke_all_ref('drush_cache_clear', $types); return $types; } function drush_cache_clear_theme_registry() { drush_db_delete('cache', 'cid LIKE :theme_registry', array(':theme_registry' => 'theme_registry%')); } function drush_cache_clear_css_js() { _drupal_flush_css_js(); drupal_clear_css_cache(); drupal_clear_js_cache(); } /** * Clear the cache of the block output. */ function drush_cache_clear_block() { cache_clear_all(NULL, 'cache_block'); }