If you try to use the solr-phpclient drush command and the module is disabled, it fails because the drush commands are in the module and you don't see them if the module is disabled. If you try to drush enable the module, it fails because the dependency checking fails due to missing PHP client. The solution would be to move the drush stuff to an include file.

Comments

pwolanin’s picture

Or, perhaps, move the requirements check to be just a runtime check?

and/or add a drush make file in addition or instead?

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

This makes it just a runtime requirement.

elliotttf’s picture

Status: Needs review » Needs work

The patch works if you're configuring with Drush, but if you're enabling modules through the admin UI you'll encounter a fatal error if you click the "Search is enabled. Your site is currently 0% indexed." after enabling the modules.

pwolanin’s picture

Ah, hmm, that's a good point. I didn't think it would be a fatal error, since we have an "include_once()" not "require_once()"

What fatal are you seeing in the log? Is it a "class not found" error or something else?

pwolanin’s picture

Oh, there is a require_once in the Drupal_Solr_Service file.

I'm tempted to rm the drush command and add a drush_make file... what do you think?

elliotttf’s picture

Fatal error: require_once() [function.require]: Failed opening required 'SolrPhpClient/Apache/Solr/Service.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/d6.com/sites/all/modules/apachesolr/Drupal_Apache_Solr_Service.php on line 2

elliotttf’s picture

StatusFileSize
new68.51 KB

Here's the stack trace

elliotttf’s picture

Yeah, the drush command doesn't make a lot of sense unless you got into some weird case where the module was enabled but the library went away.

Drush make sounds good as a convenience though. Libraries API might provide an interface for downloading code too but can't remember off the top of my head.

pwolanin’s picture

i'm trying some more variants, but there is no easy way to do this and avoid fatal errors afaikt.

pwolanin’s picture

StatusFileSize
new2.6 KB

This patch has more hacking around - still doesn't work. I get:

Fatal error: Class 'Apache_Solr_Service' not found in /Users/Shared/www/apachesolr-6.x/Drupal_Apache_Solr_Service.php on line 4
pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new549 bytes

Here's a drush make file. It works ok if run from the directory itself, but not sure it will work recursively.

pwolanin’s picture

StatusFileSize
new3.11 KB

oops - missed needed changes to the drush inc file.

rupl’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #12 worked for me. The makefile fetched the library properly and allowed me to drush enable apachesolr.

pwolanin’s picture

ok, we should probably update the README too.

elliotttf’s picture

StatusFileSize
new3.74 KB

Here's the same patch with an update to the README file.

pwolanin’s picture

thanks elliotttf!

pwolanin’s picture

Status: Reviewed & tested by the community » Fixed

committed

Status: Fixed » Closed (fixed)

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

kyle_mathews’s picture

Status: Closed (fixed) » Needs work

Wait... why was this committed? It broke my (and 100s of others) make files. Until Drush Make figures out how to handle recursive make files correctly #947158: Recursive makefiles can cause conflicts, modules shouldn't include actual make files in their modules. The best thing to do now is to name this make file apachesolr.make.example.

Some other issues:
#839580: Make file broken with drush make 2.0 - remove it please
#1103872: Change name of ckeditor.make to ckeditor.make.example for drush make module

Patch forthcoming.

kyle_mathews’s picture

Patch to move the make file to apachesolr.make.example

kyle_mathews’s picture

Also update the README file with the new make file name.

jpmckinney’s picture

Status: Needs work » Needs review
pwolanin’s picture

Well, I found the issue above about recursive make files AFTER I committed it. Obviously I would not have put it in if I'd known ahead of time that drush make is broken when it clearly advertises support for recursive make files.

pwolanin’s picture

Status: Needs review » Needs work

In any case, please provide a normal patch, or if you want to make a git formatted one, it should only have one commit in it.

kyle_mathews’s picture

Sorry. It's a bit frustrating as this sort of thing keeps happening with various contrib modules. But obviously that's Drush Make's problem not yours. What you were trying to support is how things *should* work. A new patch is attached.

nick_vh’s picture

Committed, thanks for the advice!

nick_vh’s picture

Status: Needs work » Fixed
pwolanin’s picture

It seems like this recursive building was working - was this change still needed?

nick_vh’s picture

Status: Fixed » Closed (fixed)