Significant Bug in PerchCollectionImporter.class.php that deletes entries when updating them.

  • drewm and core team. I have been working with the api today and specifically updating entries in a collection.
    I hit a problem that halted me for several hours. In that when I was trying to update an entry, the entry was simply being removed from the collection.
    After much debugging and assistance from hus_hmd, I believe the problem lies in the `PerchCollectionImporter.class.php` file on line 127.

    When I commented out this line [tt]$Collection->create_new_revision($Item);[/tt] - everything worked as expected and collection items were updated and no longer removed.

    I am hoping that this issue can be resolved and updated in the core so I don't need to update this each time I update the core.

  • No I have it set to 3, then I removed it entirely so it used the default 30. I did this before I commented out the line as I wondered if this was the cause. But it seemed to still have an issue until i commented it out. I saw when testing that the old revisions remained in the database but when it ran the code (untouched) it seemed to remove the last/latest revision from the database completely, thus then appearing as thought it had been remove it from the collection. Only what occurs is that the last (current) revision is gone. It feels like a bug, but I could be mistaken.

  • I see.

    The thing is, Runway creates a new revision regardless of the way you update the item. So if you update the item via the control panel, Runway creates a new revision in this context too. Are you able to update collection items without issues via the control panel? If so, the cause could be elsewhere.

  • If I'd start by overwriting your perch/core (same Runway version) just in case not all files were moved successfully to your project folder.

    Then you can create a reduced test case. Create a new master page with nothing but the import code. You may even want to create a new collection for testing. Remove as much project-specific code from your tests as possible.