CRAM should check whether md5.js is available during installation/activation of it. Unless there's a more elegant way, I'm thinking to insert a check in cram_install() followed by a drupal_set_message() if the file doesn't exist.

Comments

Freso’s picture

Status: Active » Needs review
StatusFileSize
new793 bytes

After pounding #drupal (and specially killes, sorry for not being clear!) with questions, I think I figured out how to handle this. And that is what the attached patch does. However, so far it's only been tested theoretically, as I haven't had time to run it through my test site! So, yes, please test. :)

Freso’s picture

StatusFileSize
new809 bytes

And here's another take on patch and wording. (Still not tested though.) The wording is taken from line 75 of cram.module, though it's been changed to use @module_path in the string, instead of using the variable directly.

Freso’s picture

StatusFileSize
new692 bytes

Okay, even if you're returning FALSE, the module still registers as having been activated, but the schema still wasn't installed with the above snippet. I've changed it a bit to check whether the file exists and simply throw an error if it doesn't, but otherwise proceed as normal. There are also the watchdog messages that will (hopefully) remind the site admin(s) of the issue, if they do not fix it when they enable to module.

Oh, and I'd like to make the watchdog warning use @module_path instead of $module_path as well? I know it's not user input, but it doesn't harm to have Drupal parse the string anyway, just for good measure. :)

selmanj’s picture

Status: Needs review » Needs work

http://api.drupal.org/api/function/hook_requirements/6

We should probably implement the check using this hook. Its supported in D5 as well too.