Since the nodeaccess rebuild function can be quite resource intensive, it is dangerous to run it by default in cache-clear all.

Let's move it to a separate command: drush nodeaccess-rebuild Alias [nar].

Comments

I agree that nodeaccess should not be rebuilt from "drush cc all." And it should probably not show up in the "drush cc" menu of options. However from my testing "drush cc all" does rebuild nodeaccess,

In fact it does not work by iterating over the "drush cc" options at all. This might be a bug, an oversight or desired behavior. I'm not sure. Following the code, it just calls it's own callback like any of the other options. That callback, drush_cache_clear_both(), calls two other functions: drush_cache_clear_drush() and drupal_flush_all_caches(). drush_cache_clear_drush() only clears drush caches. However it does so by calling twice a function with a somewhat misleading name: drush_cache_clear_all()

drush_cache_clear_all() does not clear all caches. It takes arguments for which caches to clear. If those arguments are left empty, it'll go into a foreach loop that looks like it would clear all caches but this return would cause the only first $bin to actually clear.

If I have all of that right, I suggest this solution:

1. Remove nodeaccess from all things drush cc. It should be a completely separate command.
2. The seemingly unintended "return" in drush_cache_clear_all() should be taken out so that the foreach loop can complete.
3. This call to drupal_flish_all_caches() should be replaced with drush_cache_clear_all() with no arguments.

Title:Remove 'nodeaccess' from cache clear allRemove 'nodeaccess' from cache clear
Status:Active» Fixed

Thanks for that analysis.

nodeaccess is not part of 'all'. You have to explicitly select it in order for it to run.

I implemented 1. and 2 and committed to both master and 5.x

As for 3, those are different things. drupal_flush_all_caches() clears drupal stuff. drush_cache_clear_all() clears drush's internal caches.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.