DBTNG no longer supports chaining on db_select(), so lines 286-290 of actions.inc don't work.

The code currently reads:

      $results = db_select('actions')
        ->addField('actions', 'aid')
        ->addField('actions', 'description')
        ->condition('callback', $orphaned, 'IN')
        ->execute();

We probably want something more like:

      $query = db_select('actions');
      $query->addField('actions', 'aid');
      $query->addField('actions', 'description');
      $query->condition('callback', $orphaned, 'IN');
      $results = $query->execute();

However, if #314464: Convert db_placeholders() to DBTNG is resolved, this should probably be changed into a static query using db_query() rather than db_select().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Yeah that was my bad. I didn't know that db_select couldn't be chained like db_insert/update/delete...

Dave Reid’s picture

Assigned: Unassigned » Dave Reid

Assigning myself to fix this.

Dave Reid’s picture

Issue tags: +actions
Dave Reid’s picture

Priority: Normal » Critical
mr.baileys’s picture

Status: Active » Needs review
FileSize
1.02 KB

I ran into this issue while working on #306662: Add redirect option to site-wide contact forms.

@Dave Reid, I hope you don't mind but since I had to get past this error I rolled a patch according to cwgordon7's instructions...

cwgordon7’s picture

Well, since #314464: Convert db_placeholders() to DBTNG has been resolved, I believe this query can probably be converted to a static db_query() query?

Dave Reid’s picture

Status: Needs review » Needs work

@mr.baileys No problem at all. :)

Agreed with cwgordon7. This can be a nice db_query()->fetchAll() function now.

$actions = db_query("SELECT aid, description FROM {actions} WHERE callback IN (:orphaned)", array(':orphaned' => $orphaned))->fetchAll();
foreach ($actions as $action) {
  ...
mr.baileys’s picture

Status: Needs work » Needs review
FileSize
1012 bytes

re-rolled taking the comments from #7 and #8 into account. If this gets commited, credit goes to Dave Reid and cwgordon7, as I merely poured their code into patch-form.

mr.baileys’s picture

FileSize
1012 bytes

Let's use single-quotes instead :)

Dave Reid’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually and works, looks good, and testbot likes. We have more extensive tests for orphaned actions coming.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed -- and looking forward to those tests. :-)

Status: Fixed » Closed (fixed)
Issue tags: -actions

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