Problem/Motivation

When moving an entity from one changeset to another, we first use cps_is_entity_in_changeset() to ensure that the entity does not exist in the destination changeset. Since cps_is_entity_in_changeset() uses cps_get_tracked_entities() which in turn does a query restricting the entities to published=0, it's possible that the entity does actually exist in the destination changeset, which then causes a SQL duplicate key exception when cps_move_changeset() is called and does a simple db_update() of the changeset id.

Proposed resolution

Add a new optional argument to cps_get_tracked_entities() to explicitly get all entities, and not just unpublished ones, and use this in cps_get_tracked_entities()

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

douggreen created an issue. See original summary.

douggreen’s picture

Status: Active » Needs review
FileSize
1.93 KB

Patch attached

douggreen’s picture

Issue summary: View changes
douggreen’s picture

Updated patch also moves the module_invoke_all of the cps_move_changeset hook inside the transaction.

douggreen’s picture

This is just fixing a symptom of a problem (other than the transaction change, which might be related to the real problem). The root problem is that a cps_entity has a published=1 value when the changeset itself is not published.

  • douggreen committed 03a3868 on 7.x-1.x
    Issue #3218341 by douggreen: moving hook_cps_move_changeset inside...
douggreen’s picture

A minimal change was committed to see if that solves the problem first ... before doing the bigger change here.

Updated patch is attached.