The location_views_default_views() function in location_views.module contains an explicit dependency on CCK by using the node_type table as shown below
// cck content types all identify themselves as module 'content'
// need to find type name, then check to see if that type has been location-enabled
$cck_types = db_query('SELECT type_name FROM {node_type} nt ORDER BY nt.type_name ASC');
while ($type = db_fetch_object($cck_types)) {
As far as I can tell, this causes one or more of the following error to appear when enabling arbitrary modules, and occasionally under regular site use:
Table 'drupal.node_type' doesn't exist query: SELECT type_name FROM node_type nt ORDER BY nt.type_name ASC in /home/mclewin/public_html/includes/database.mysql.inc on line 120.
CCK itself is not part of the 4.7 core, and the location module does not make it's dependency on CCK explicit. Non technical users will probably have difficutly tracking this error back to the location_views.module.
I see three options for resolving this (I'm confident that there are others). In order of my preference they are:
- Branch location api/module for Drupal 4.7 (right now it has a 4.6 branch and HEAD)
- Remove the CCK dependency or wrap this logic within
if (module_exist("content")) - Explicitly test for the presence of CCK in the location.install file
Comments
Comment #1
karens commentedThe location_views module is supposed to be 4.7 or cvs, it was not tested on 4.6. I didn't realize it got marked as 4.6, and I'm not sure what needs to be done to fix that, but I'll check around. It *may* work on 4.6 but I haven't tested it.
It shouldn't need cck to work, so I need to change my test for location types to be sure there is no dependency. However, there have also been changes to both views and cck since I posted this module, so it needs a bit of a re-work anyway (probably nothing major, just double-checking that everything still works as it should).
Comment #2
karens commentedI've got a couple fixes to post that should straighten things out. There is only one issue that might be a problem with using it in 4.6 and it's not really a problem, it's that I have to test that the location tables have been updated to utf8 in 4.7 and I don't need that test in 4.6 and 4.6 modules will always fail that test. I can't find any function or variable that will tell me whether someone is using 4.6 or 4.7. Does anyone know of some way the module can test for that?
Comment #3
karens commentedI guess I don't really need to test for the drupal version (although I'd still like to know if there is a way to do it) I just need to leave the utf8 test out of the 4.6 version and in the cvs/4.7 version. Now I just have to figure out what I need to do to get the module versions marked for the right drupal versions...
Comment #4
karens commentedOK, I just committed changes to HEAD that should remove any dependency on cck. I checked and the module does not show up in the 4.6 branch in cvs, it is only in HEAD, which is where I thought it was.
I did add some instructions inside the module about what would need to be changed to make it work in 4.6 (2 lines would need to be commented out) but I am not going to branch or maintain a 4.6 version. Since the location module itself is not yet officially branched to 4.7, I'm not going to branch to 4.7 yet either, but it should work fine in 4.7.
Re-open if that does not fix things.
Comment #5
scott.mclewin commentedMy apologies for the confusion on 4.6 - I went back and checked and the location.module is in 4.6, location_views.module is not. That was my error. I try so hard to do my homework too before I submit a change request to another developer. I looked at location module/api as a whole and didn't check the tag on the location_views.module file only. Again sorry for that.
I'll drag down the latest CVS tomorrow into my 4.7 site and report back. I totally understand not wanting to branch yet given the overhead double deltas take once a branch deviates from head. I am glad you were willing to remove the CCK dependency.
I love the capabilities the location module opens up BTW. Nicely done.
Comment #6
scott.mclewin commentedI've installed and tested the change in my 4.7 site. The errors are all gone. And..for the first time the location table is showing results too.
Thanks.
Comment #7
karens commentedGlad it's working now. No problem on the 4.6/4.7 confusion. I was just worried that it really did get tagged wrong :-)
Comment #8
karens commentedI've set up a separate project for the location_views module to make it easier to track bugs and feature requests. Moving this issue to that page.
Comment #9
(not verified) commented