Problem/Motivation

When importing exportable entities using the import form, the option to overwrite an existing entity does not correctly update the existing entity's export status. This means that when overwriting a 'default' configuration your changes will be deleted the next time caches clear.

This can cause seemingly random and severe changes in sight behaviour depending on what the configuration does.

Rules has same issue after copying the code from EntityAPIControllerExportable: #2027717: Import form doesn't set Rule status to 'Overridden'

Proposed resolution

Make sure the status gets copied onto the imported copy of the entity. This will make sure that the entity status gets updated in EntityAPIControllerSave.

Remaining tasks

Write patch.

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#3 2649382-3.patch781 bytesrlmumford
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rlmumford created an issue. See original summary.

rlmumford’s picture

Add related issue

rlmumford’s picture

Status: Active » Needs review
FileSize
781 bytes
Chris Matthews’s picture

Assigned: rlmumford » Unassigned

The 3 year old patch in #3 to entity.ui.inc applied cleanly to the latest entity 7.x-1.x-dev and (if still relevant) needs review.

TR’s picture

Priority: Critical » Major
Status: Needs review » Needs work

Yes this is a bug. The patch proposed in #3 is very similar to the patch proposed for Rules. However, the Rules patch was not correct, as explained in #2027717-5: Import form doesn't set Rule status to 'Overridden'. To fix Rules took a considerably bigger patch plus a test case to demonstrate the bug and prove the solution. A similar solution can be used in the Entity API, but it's going to require reading that Rules issue and making a similar patch, WITH TESTS, for the Entity API.

I am not planning on doing that before D7 EOL, but I will review any contributed patches intended to solve this. Right now the functionality is broken so I'm not too worried that committing something to fix it will cause a problem.