Branched from : http://drupal.org/node/335360#comment-1165590
I checked through the code for usage of drupal api functions, and couldn't find any that had changed significantly to mess up what was happening,
on reading through the code i saw that drush_commandfile_list was being called twice , once before drupal is initialized to find a possible lower bootstrap level to initialize at, and once to actually dispatch the command (when you have been bootstrapped).
What I found was that commandfile_list was caching the results, and the was no way to cleanly pass a $refresh parameter down through the call tree, because some functions use things like func_get_args().
Eventually I just removed all static caching, because drush_commandfile_list should only really be called twice AND it would be required to refresh it every time you called it (mostly anyway). The file system cache also makes the next searches pretty fast,
so it was a needless optimization at this point.
Here's a patch for head. Please test.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drush_no_statics.diff | 5.23 KB | adrian |
| drush_no_statics.diff | 4.64 KB | adrian |
Comments
Comment #1
adrian commentedComment #2
adrian commentedHere is an updated version of the patch, that keeps the commandfile_list caching, but moves the cache to it's own function, which can be wiped out when needed through the drush_commandfile_cache_flush() helper function.
I do not believe we need additional layers of caching other than this.
Comment #3
moshe weitzman commentedCommitted to HEAD.
Adrian convinced me that we do not need our command.inc to mirror module.inc for D7. That does some heavy mojo related to the code registry. We don't need all that, as our command engine just dispatches to a single command, or lists all commands. Not a big deal to discover commands on the filesystem, as Drupal used to do for .module files way back when.
The only slightly odd part of this patch is the magic constant that gets passed to _drush_commandfile_cache() that wipes the cache. Drupal usually uses a $reset param for this but its a minor point.
Thanks Adrian. Sorry all for raising an alarm about this.