On lines 342-344 of nodequeue.module, in the nodequeue_apachesolr_update_index() function, subqueues are retrieved with nodequeue_get_subqueues_by_node() and then nodequeue_set_subqueue_positions() is called with the subqueues as an argument. The problem is, nodequeue_set_subqueue_positions() blows up if the list of subqueues is empty. For example, when indexing, I would get errors like this from nodequeue_set_subqueue_positions():

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND nid = 110380 GROUP BY sqid' at line 1 query: SELECT sqid, MIN(position) AS position FROM nodequeue_nodes WHERE sqid IN () AND nid = 110380 GROUP BY sqid in /var/shared/sites/211sandiego/site/sites/all/modules/nodequeue/nodequeue.module on line 2394

To avoid there errors, I just ensure $subqueues is not empty before calling nodequeue_set_subqueue_positions(). Here is a patch.

Comments

jpmckinney’s picture

Status: Active » Needs review
ezra-g’s picture

Thanks for this patch.

Would it work for your use case to simply make nodequeue_set_subqueue_positions not explode when $subqueues is empty?

The attached patch implements this.

ezra-g’s picture

StatusFileSize
new674 bytes

...and here's the patch.

ezra-g’s picture

Status: Needs review » Fixed

I committed the later version of this patch. Thanks!

jpmckinney’s picture

Looks good. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.