Closed (fixed)
Project:
RDF Extensions
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Oct 2010 at 16:54 UTC
Updated:
13 May 2011 at 16:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
cyberswat commentedComment #2
dman commentedI think this is a valuable, constructive addition.
Though I'd prefer to look and see that the required file(s) was actually there - it's possible to unpack things incorrectly - eg into a subdirectory.
Comment #3
scor commentedwe should not care where the files are located, as long as the library ARC2 is available (in fact rdfx.module allows for 2 locations for the library to live at). class_exists('ARC2') should do it.
Comment #4
dman commentedyes, even better
Comment #5
Anonymous (not verified) commentedChanged the check from is_dir to class_exists. I tested it with latest version of RDFx, and it works.
Comment #6
dan7 commentedI tested the last patch and it worked for me as well.
Comment #7
scor commentedI've committed the patch #5 for now so we have some safety net to remind people.
I'm leaving this issue open as we could display more information to the user on how to download ARC2 (check the D6 code). and how about a drupal_set_message() on the modules page with similar instructions? we could also display the version of ARC2 used in status report.
Comment #8
milesw commentedThis patch adds the ARC version to the status report and installation instructions if ARC is not installed.
It also adds a very visible warning when ARC can't be loaded. I'm not sure we want to nag users this much, so I'm including a version without this message.
Comment #9
scor commentedThis is great stuff Miles! I definitely like the improve status report!
Looking at your patch, it adds a message in hook_init() which will be displayed on every single page, indeed, not convinced we need to nag users so much, maybe we could only display it in some places only, like in the admin area, or in the admin RDF settings page. Status report should automatically display a red warning anyways. How about a message upon enabling the RDFx module at the top of the modules pages? That should do no harm...
Comment #10
Anonymous (not verified) commentedI do something like this in Evoc, the text is "You can now import the core RDF vocabularies." It even shows up when people enable using Drush.
The only thing I would do differently is change the wording to "You can now import the core RDF vocabularies by going to....." so that people using Drush would know where to go.
Comment #11
milesw commentedSo by default, if hook_requirements encounters a REQUIREMENT_ERROR, it will display a warning that points to the status report page, but this warning only appears in the Configuration section.
My reasoning for including the notice in hook_init() and making it so visible is that RDFx is quite dependent on ARC. It will fail very badly if you hit a page that uses ARC classes -- that's most config pages for RDFx. You will either get a fatal "Class not found" or even worse, a white screen. If someone just installed/enabled the module, I'd rather nag them than let them run into nasty errors like that. Am I being too cautious?
Comment #12
scor commentedyou're right, I quite like the idea of nagging people until they've installed it. Can't think of a use case where you would use rdfx without ARC2. I wonder how other modules which require a library achieve this type of thing.
Comment #13
Anonymous (not verified) commentedI'm thinking instead of nagging people on every page, we might want to add better error handling. We could have a special include function... when ARC can't be found, then we give the message.
Comment #14
milesw commented@linclark
Yep, you're right, that's the ideal solution.
I looked at the Apache Solr module and the Search Lucene module (D6 versions), which both have library requirements. Solr does not include any special measures for preventing fatal errors, it just relies on hook_requirements. Search Lucene also uses hook_requirements on both install and runtime, but is also setup to fail gracefully if the required library is missing. The author describes this in #525608: Add safeguards to prevent fatal errors when the ZF Components become unavailable.
I'll make a new patch that adds the 'install' phase for hook_requirements, but adding extra error handling should be a separate issue.
Comment #15
Anonymous (not verified) commentedSounds good.
Just a note, I did
drush sion a site with RDFx and got the message because libraries wasn't enabled. We may want to add some help text below that mentions:Comment #16
milesw commentedBah, this is tricky. By making ARC required during install phase, the module can't be enabled if ARC isn't present. This makes sense, except it also means the drush command for downloading ARC isn't available.
The check on install phase also only covers that very first installation. Subsequent re-enabling of the module won't be affected even if ARC is missing.
I'm thinking the second patch in #8 (without the nag message) is good enough for this issue. I opened a separate issue to address error handling.
Comment #17
Anonymous (not verified) commentedI'm thinking that we probably want to keep the drush command, it really simplifies the download process. If we have proper error handling, do we still need hook_requirements?
Comment #18
milesw commentedYeah, we still want hook_requirements for runtime so the status report shows whether ARC is installed properly. The Configuration page will also show a "There is a problem with your Drupal installation" message.
It's only hook_requirements at install phase that would interfere with the drush command.
The second patch in #8 simply adds more information to the status report per scor's comments in #7. If we get it tested we can commit it and close out this issue.
Comment #19
scor commentedlet's not do hook_requirements during install then, the drush command is really handy, and cannot be used before installing the rdf module (drush used to allow that but not anymore).
Comment #20
Anonymous (not verified) commentedAhh, I didn't realize that there were two phases. Ok, this is committed. I just made a small wording change to make the install instructions a little easier for noobs.
Fixed with commit http://drupalcode.org/project/rdf.git/commit/0df6e92
Comment #21
milesw commentedIf you ever have to deal with hook_requirements for install phase, make sure to put it in the .install file instead. Seems like many have lost hair over that one. :)
Thanks for wrapping this one up!
Comment #23
milesw commented