Problem/Motivation

In tracker,module, function _tracker_remove() performs the same database update to table tracker_node twice.

      // And then we push the out the new changed timestamp to our denormalized
      // tables.
      $connection->update('tracker_node')
        ->fields([
          'changed' => $changed,
          'published' => $node->isPublished(),
        ])
        ->condition('nid', $nid)
        ->execute();
      $connection->update('tracker_node')
        ->fields([
          'changed' => $changed,
          'published' => $node->isPublished(),
        ])
        ->condition('nid', $nid)
        ->execute();

I believe the second update should be made to table tracker_user instead. That's the pattern we see in the next few lines of code:

  else {
    // If the node doesn't exist, remove everything.
    $connection->delete('tracker_node')
      ->condition('nid', $nid)
      ->execute();
    $connection->delete('tracker_user')
      ->condition('nid', $nid)
      ->execute();
  }
CommentFileSizeAuthor
#6 3268794-6.patch460 bytesjuancec

Issue fork tracker-3268794

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

davidhk created an issue. See original summary.

mradamjohn’s picture

Looks reasonable to me, David.
Great catch.

Will need to be reviewed/tested..

avpaderno’s picture

Issue tags: +Novice
avpaderno’s picture

Title: _tracker_remove() updates wrong table » _tracker_remove() updates twice the same database table
juancec’s picture

Assigned: Unassigned » juancec

I'll work on it.

juancec’s picture

Assigned: juancec » Unassigned
Status: Active » Needs review
StatusFileSize
new460 bytes

Please kindly review it.

avpaderno’s picture

Status: Needs review » Reviewed & tested by the community

I checked the tracker.module file. That is the only case where the same database table is updated twice.

batigolix made their first commit to this issue’s fork.

batigolix’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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