Problem/Motivation

As a feeds administrator whose recent import has caused unwanted changes (updates) to entities with revisions enabled, I want to revert to the revision before the import, so that I can undo the unwanted changes.

In Feeds 7.x-2.x, it is possible to delete all nodes affected by a Feeds import using the "Delete items" tab on the import page. This useful when an importer created nodes. However, if the importer modified existing nodes, it is not desirable to delete them.

If a content type is configured so that new revisions are created by default, and Feeds updates nodes of that content type, then \FeedsNodeProcessor automatically creates a revision named "Updated by FeedsNodeProcessor" when it saves its changes.

Proposed resolution

Provide a bulk operation similar to the "Delete items" tab, which looks through each entity modified during an import, and reverts them to the revision before the "Updated by FeedsNodeProcessor" revision.

Remaining tasks

  1. Collaborate with #2692945: Add ability to revert imported data (for entities that support it)
  2. Write tests
  3. Reviews, feedback
  4. RTBC, feedback
  5. Commit

User interface changes

When viewing an import form (at import/%feeds_importer), there is a "Roll back items" tab. Clicking on it presents a similar interface to the "Delete items" tab. Performing the "Roll back" operation goes through each entity modified during the import. If that entity has an "Updated by FeedsNodeProcessor" (etc.) revision, then the node is reverted to the revision before that one.

API changes

The \FeedsSource class gains the following functions:

  1. \FeedsSource::startRollback(), which operates in a similar manner to startClear()
  2. \FeedsSource::scheduleRollback(), which operates in a similar manner to scheduleClear()
  3. \FeedsSource::rollback(), which operates in a similar manner to clear()
  4. \FeedsSource::progressRollingBack(), which operates in a similar manner to progressClearing()

Data model changes

None.

Comments

mparker17 created an issue. See original summary.

mparker17’s picture

Title: Provide a "rollback items" operation for feeds that import to nodes with revisions turned on » Provide a "rollback items" operation for feeds

Simplify the issue title somewhat.

megachriz’s picture

I have not read the issue in detail yet, but is this issue perhaps the same as #2692945: Add ability to revert imported data (for entities that support it)?

mparker17’s picture

Status: Active » Needs review
StatusFileSize
new14.67 KB

@MegaChriz, I wasn't aware that issue existed, but I'll check it out in greater depth shortly.

For now, here's the start of patch for this issue. This patch needs tests; so if it doesn't break any of the existing tests, I'll move it to needs work.

megachriz’s picture

I've glanced through the code and it looks nifty. Could take me a while before I'm able to do a proper review though. I have also some other Feeds issues on my list that I like to get done. Maybe you could contact nvahalik (who created #2692945: Add ability to revert imported data (for entities that support it)) and work together on this issue as that other issue looks at least very similar.

mparker17’s picture

Issue summary: View changes
Status: Needs review » Needs work

@MegaChriz, sounds good.

Moving back to needs work as promised. Updating remaining tasks in issue summary.

bluegeek9’s picture

Status: Needs work » Closed (outdated)
//www.flaticon.com/free-icons/thank-you Thank you for your contribution!

Unfortunately, Drupal 7 is End of Life and no longer supported. We strongly encourage you to upgrade to a supported version of Drupal.

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.