When installing imagecache at the same time as node_gallery, the installation process does not (necessarily) install things in the correct order.
Since node_gallery.install contains a call to imagecache code, things fail.

This patch uses hook_requirements() to prevent the failure. The user needs to do two install runs if imagecache was not enabled yet, but at least the system does not break.

(This is basically a workaround for a known bug in the Drupal install system - that looks like it won't get fixed in D7 yet. See http://www.drupaler.co.uk/blog/using-hookrequirements-drupal-6x/135 for more info.)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dbeall’s picture

This is also covered in the handbook http://drupal.org/node/544242 ;How to install node gallery

kmonty’s picture

Assigned: Unassigned » kmonty
kmonty’s picture

Status: Needs review » Needs work

The patch is close, but, for example, if you only click to enable Node Gallery Access with node gallery and imagecache not enabled, it will prompt you with the "(Currently using Node Gallery requires ImageCache module to be pre-installed. If ImageCache is now installed, please enable Node Gallery again.)" error, yet Node Gallery Access is installed/enabled and Node Gallery is locked.

roderik’s picture

Status: Needs work » Needs review
FileSize
4.92 KB
3.64 KB

Ouch.

I cannot reproduce your problem. (The order of installing modules seems to be different over different installations, but consistent per installation.)
But yes, that is a problem that I didn't think of, when things are installed in the order:
- Node Gallery (failing)
- ImageCache
- Node Gallery Access

The thing is... conceptually node_gallery_access.install should check for 'node_gallery' being installed already- not 'imagecache'. (as in node_gallery-installreqs2.patch)

But if we do that, then ALL users (also the ones who first install imagecache and then node_gallery+access) are more likely to get an error message, and to have to do the install in multiple steps. We don't want that, do we?
So I solved it by giving an error when 'either imagecache is not installed, OR Node Gallery has already given an error message'. Tested, and it works for me (though my install order of modules is different than yours).

If you agree to that approach (at least until Drupal core fixes its installation order in D8 or so)... you can apply (only) node_gallery-installreqs3.patch.

kmonty’s picture

Priority: Normal » Critical

Thanks for the patch, I'll review it this week. Also marking it as critical as it should be a release blocker.

kmonty’s picture

Status: Needs review » Fixed

Fixed with this commit. I ended up using requirements3 and changed the text slightly to this just to make it more clear: "ImageCache module to be pre-installed. If ImageCache is now installed, please enable Node Gallery Access again. If ImageCache and Node Gallery Access are both enabled and Node Gallery is disabled and grayed out unchecked, saving the module settings page again will install Node Gallery."

Thanks for all your help roderik!

Status: Fixed » Closed (fixed)

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