Posted by Hugo Wetterberg on July 24, 2008 at 9:09am
| Project: | Similar Nodes |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Curly brackets have been left out at line 137. Critical bug that could wreck multi-site installs.
137c137
< $build_q = 'INSERT INTO {similarnodes} (nid,tid,weight) SELECT n.nid, tn.tid, "%d" as weight FROM node n , term_node tn , term_data dt WHERE n.nid = tn.nid AND tn.tid = dt.tid AND dt.vid = %d';
---
> $build_q = 'INSERT INTO {similarnodes} (nid,tid,weight) SELECT n.nid, tn.tid, "%d" as weight FROM {node} n , {term_node} tn , {term_data} dt WHERE n.nid = tn.nid AND tn.tid = dt.tid AND dt.vid = %d';
Comments
#1
Here's a patch to fix this and also to fix the query style. Drupal standard is to use "INNER JOIN" instead of doing joins inside of the WHERE clause.
#2
+1
Though the patch is missing curlies on term_data :)