Error if content type does not contain a Link field
jupiterchild - May 14, 2008 - 08:18
| Project: | Link 404 checker |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
Invalid argument supplied for foreach() in /home/****/****/cms/sites/all/modules/link_checker/link_checker.module on line 96.
While configuring Link 404 Checker I inadvertently selected a content type which does not have a Link field. On running Cron I received the above error.

#1
The previous post should have stated "On running Cron I received the above error in the log file"
This is the actual error message when running Cron:
Warning: Unknown column 'c.field_google_earth_url' in 'field list' query: SELECT c.nid, c.vid, c.field_google_earth_url as link FROM content_type_page c LEFT JOIN link_checker lc on c.nid = lc.nid && c.vid = lc.vid && c.field_google_earth_url = lc.field_name WHERE c.field_google_earth_url != '' ORDER BY lc.last_checked ASC LIMIT 1 in /home/****/****/cms/includes/database.mysql.inc on line 172
Warning: Cannot modify header information - headers already sent by (output started at /home/****/****/cms/includes/database.mysql.inc:172) in /home/****/****/cms/includes/common.inc on line 314
Problem goes away when I deselect the content type not containing a Link field.
#2
im stil new to drupal.soryy
#3
My original error report may not be correct.
I installed this on another site where I have 3 node types ALL using Link fields. When I run Cron, 1 node type is OK but the other 2 give errors e.g.
Warning: Unknown column 'c.field_person_famtree_url' in 'field list' query: SELECT c.nid, c.vid, c.field_person_famtree_url as link FROM content_type_place c LEFT JOIN link_checker lc on c.nid = lc.nid && c.vid = lc.vid && c.field_person_famtree_url = lc.field_name WHERE c.field_person_famtree_url != '' ORDER BY lc.last_checked ASC LIMIT 1 in /home/****/****/****/cms/includes/database.mysql.inc on line 172
Warning: Unknown column 'c.field_person_famgroup_url' in 'field list' query: SELECT c.nid, c.vid, c.field_person_famgroup_url as link FROM content_type_place c LEFT JOIN link_checker lc on c.nid = lc.nid && c.vid = lc.vid && c.field_person_famgroup_url = lc.field_name WHERE c.field_person_famgroup_url != '' ORDER BY lc.last_checked ASC LIMIT 1 in /home/****/****/****/cms/includes/database.mysql.inc on line 172
#4
I don't have an answer at the moment but I'll look into it.
#5
The link_checker.module adds an '_url' to each fieldname to check.
As far as I can see it, field_names should be left as they are. It makes no sense to add that '_url'.
I modified the code, did a cron run and the error did not come up again.
On the other hand, I do not know, if the links are checked correctly now.
Patch attached.
#6
#5 patch is incorrect. The module adds _url because it is checking the URL in the database and not the field itself. The link module automatically appends _url to the field_name when creating the database column for link storage.
If you take this out, these errors would go away but your links wouldn't be checked either.
I think what is needed is better error checking.
#7
Changing title back..