Planet does not work if the database tables have a prefix

Bug #527974 reported by Joseph Walton-Rivers
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UD Planet
Fix Released
Medium
Michael Lustfield

Bug Description

When using the module, I noticed no feed items were being displayed. I was able to trace the cause to the query in udplanet_content.inc (function udplanet_get_items). When I edited the query to include my drupal table prefix (uc) it worked correctly.

ideally, the module should be able to prepend the correct table prefix. If this is not the case the module fails to function. For refrence, below is my changed query (it also has the checks for disable and frozen removed, because i thought they might be causing the problem, terns out they we'nt)

SELECT
uc_users.uid AS uid,
uc_aggregator_feed.title AS title,
uc_aggregator_feed.url AS url,
uc_aggregator_item.title AS heading,
uc_aggregator_item.link AS link,
uc_aggregator_item.description AS content,
uc_aggregator_item.timestamp AS time
FROM uc_udplanet_feeds
LEFT JOIN uc_users ON uc_udplanet_feeds.uid = uc_users.uid
LEFT JOIN uc_aggregator_feed ON uc_udplanet_feeds.fid = uc_aggregator_feed.fid
LEFT JOIN uc_aggregator_item ON uc_aggregator_feed.fid = uc_aggregator_item.fid
AND uc_aggregator_item.timestamp IS NOT NULL
ORDER BY time DESC;

Related branches

Revision history for this message
Joseph Walton-Rivers (webpigeon) wrote :

Also, there is not a column called time, uc_aggregator_item contains a column called timestamp, it's probably best to use that.

Revision history for this message
Michael Lustfield (michaellustfield) wrote :

Thanks for catching this. I'll get on this first part right away.

Changed in ubuntu-drupal-planet:
assignee: nobody → Michael Lustfield (mtecknology)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Michael Lustfield (michaellustfield) wrote :

"Also, there is not a column called time, uc_aggregator_item contains a column called timestamp, it's probably best to use that."
                     {aggregator_item}.timestamp AS time
                     ORDER BY time DESC
When I select the timestamp column I call it time so I can refer to it as such.

Revision history for this message
Michael Lustfield (michaellustfield) wrote :

I placed brackets around the table names which is the Drupal method for handling prefixes. This fix was pushed in r59.

Changed in ubuntu-drupal-planet:
status: Confirmed → Fix Committed
Revision history for this message
Michael Lustfield (michaellustfield) wrote :

Pushed to Drupal

Changed in ubuntu-drupal-planet:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.