Just did some profiling of `drush dd devel` and found that drush_core_find_project_pat('devel') takes 3-4 milliseconds on a small site and would take more once a site is loaded with contrib modules. Lets try to find a faster alternative to recursing all over. Perhaps query system table with drush_db_result(drush_db_select('system', array('filename'), 'name IN (:extensions)', array(':extensions' => $extensions)));

CommentFileSizeAuthor
#3 drush-1011662.patch4.53 KBjonhattan

Comments

greg.1.anderson’s picture

Assigned: Unassigned » greg.1.anderson

Probably a drush-4.1-timeframe fix.

greg.1.anderson’s picture

Assigned: greg.1.anderson » jonhattan

Maybe jonhattan has some ideas on this.

jonhattan’s picture

Status: Active » Needs review
StatusFileSize
new4.53 KB

To query the database this command needs bootstrap to _CONFIGURATION (it was reaching _SITE).

Attached patch does what Moshe proposed. Also it fix several things in the way I traced from the command callback to drush_core_find_project_path(). I think there're more opportunities to polish this.

There's a failure in tests but doesn't seem to be related to this. Will investigate it further.

side note 1: drush_core_rsync() calls drush_sitealias_evaluate_path() with $os = "rsync".I saw it is documented but it doesn't seem to be used in underlying code.

side note 2: while browsing code for this issue I found that this is valid (and not documented): drush status --project=devel,views.

I have a feeling that code involved in all of this can be simplified / decoupled.

greg.1.anderson’s picture

Answers to side notes:

For an explanation of $os = "rsync", see _drush_get_os in environment.inc. This special constant will be converted to "cwrsync" on Windows, which will cause rsync to use cygwin-style path escaping instead of Windows-style path escaping, which is very important if using rsync on Windows.

The --project stuff in drush status is used by the site alias code that handles %files or %modulename in a path alias on a remote machine; the status command is used to pull multiple results from the remote machine with a single call. This code could in fact be simplified by making a new hidden command to use in place of status.

Code in the patch looks good.

greg.1.anderson’s picture

Status: Needs review » Reviewed & tested by the community

Works well. There was one comment that is no longer applicable in _drush_core_directory:

// @self makes no sense before 'site' level.

Now it would be more applicable to say drush_sitealias_evaluate_path requires bootstrapping to DRUSH_BOOTSTRAP_DRUPAL_DATABASE.

jonhattan’s picture

Status: Reviewed & tested by the community » Fixed

Committed with a change to comment referenced in #5.

btw completeTest fails in master; not related to this commit.

jonhattan’s picture

Assigned: jonhattan » msonnabaum
Status: Fixed » Patch (to be ported)

May be backported although it contains a little API change/fix: http://drupalcode.org/project/drush.git/blobdiff/bb03a06fc0c0283a8b1b14b...

msonnabaum’s picture

Status: Patch (to be ported) » Fixed

Not worth backporting now that 5 is out.

Status: Fixed » Closed (fixed)

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