Skip to content

Commit

Permalink
Port cache commands to annotated (#2498)
Browse files Browse the repository at this point in the history
* Port cache commands to Annotated.

* Remove a code comment.

* Remove old file.

* Misc minot fixes and renames.

* Update to new cache clear method

* Remove debug code.

* Cast topic element to a bool to match old API
  • Loading branch information
weitzman committed Dec 12, 2016
1 parent 53fd6a6 commit 1b30544
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 396 deletions.
307 changes: 0 additions & 307 deletions commands/core/cache.drush.inc

This file was deleted.

6 changes: 4 additions & 2 deletions commands/core/drupal/cache.inc
@@ -1,4 +1,6 @@
<?php
use Drush\Commands\core\CacheCommands;

/**
* @file
* Engine for the cache commands.
Expand Down Expand Up @@ -38,7 +40,7 @@ function _drush_cache_command_set($cid, $data, $bin, $expire, $tags) {

function _drush_cache_clear_types($include_bootstrapped_types) {
$types = array(
'drush' => 'drush_cache_clear_drush',
'drush' => ['\Drush\Commands\core\CacheCommands', 'cacheDrush'],
'all' => 'drush_cache_clear_both',
);
if ($include_bootstrapped_types) {
Expand Down Expand Up @@ -88,7 +90,7 @@ function drush_cache_clear_block() {
* Clear caches internal to Drush core and Drupal.
*/
function drush_cache_clear_both() {
drush_cache_clear_drush();
CacheCommands::clearDrush();
if (drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {
drupal_flush_all_caches();
}
Expand Down
6 changes: 1 addition & 5 deletions commands/core/drupal/cache_8.inc
Expand Up @@ -27,10 +27,6 @@ function _drush_cache_command_set($cid, $data, $bin, $expire, $tags) {
$bin = _drush_cache_bin_default();
}

// Convert the "expire" argument to a valid value for Drupal's cache_set().
if ($expire == 'CACHE_TEMPORARY') {
$expire = Cache::TEMPORARY;
}
if (!isset($expire) || $expire == 'CACHE_PERMANENT') {
$expire = Cache::PERMANENT;
}
Expand All @@ -40,7 +36,7 @@ function _drush_cache_command_set($cid, $data, $bin, $expire, $tags) {

function _drush_cache_clear_types($include_bootstrapped_types) {
$types = array(
'drush' => 'drush_cache_clear_drush',
'drush' => ['\Drush\Commands\core\CacheCommands', 'cacheDrush'],
);
if ($include_bootstrapped_types) {
$types += array(
Expand Down
2 changes: 1 addition & 1 deletion commands/core/topic.drush.inc
Expand Up @@ -62,7 +62,7 @@ function drush_topic_core_topic($topic_name = NULL) {
}
}
if (empty($topics)) {
return drush_set_error('DRUSH_NO_SUCH_TOPIC', dt("No topics on !topic found.", array('!topic' => $topic_name)));
return drush_set_error('DRUSH_NO_SUCH_TOPIC', dt("!topic topic not found.", array('!topic' => $topic_name)));
}
if (count($topics) > 1) {
// Show choice list.
Expand Down

0 comments on commit 1b30544

Please sign in to comment.