Problem/Motivation

If you are in the situation, that you want to migrate from contribs media_entity to Drupal core media entities and also want to update from Simple Sitemap 2.x to 3.x, the update command will fail.
The reason is, that the media_entity_update_8201() function deletes automatically created media types. Those deletes trigger simple_sitemap_entity_delete(), which in turn wants to delete entries from 'simple_sitemap_entity_overrides'. This fails, because simple_sitemap updates have not been executed yet, and the table schema is wrong.

Proposed resolution

Implement hook_update_dependencies() and make media_entity update 8201 depend on dimple_sitemap update 8216 (the one who adds the type field to the simple_sitemap_entity_overrides table.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daniel.bosen created an issue. See original summary.

gbyte’s picture

Title: Updating Simple XML Sitemap 2 to 3 at the same time as updating media_entity to media in core fails » Concurrent update of media module and simple_sitemap 2.x to 3.x fails.

Thanks for the report, I will be happy to commit a patch if you care to test and submit it.

gbyte’s picture

Title: Concurrent update of media module and simple_sitemap 2.x to 3.x fails. » Concurrent update of media module and simple_sitemap 2.x to 3.x fails
daniel.bosen’s picture

That's the patch, that works for us.

gbyte’s picture

Status: Active » Needs review
alexpott’s picture

I think we can do better here. The problem is that these hooks are also fired on config entity delete but simple_sitemap is not at all interested in these entities as far as I can see. See \Drupal\simple_sitemap\EntityHelper::getSupportedEntityTypes().

alexpott’s picture

Something like this should work and make Simple Sitemap more resilient during the update path.

daniel.bosen’s picture

Status: Needs review » Reviewed & tested by the community

This patch also works. And it is the better approach. Simple Sitemap now only processes entities, that are relevant. And messing with the update dependencies should be avoided, if possible.

alexpott’s picture

Some indentation issues.

  • gbyte.co committed e1906c7 on 8.x-3.x
    Issue #3062747 by alexpott, daniel.bosen, gbyte.co: Concurrent update of...
gbyte’s picture

Status: Reviewed & tested by the community » Fixed

@alexpott I like that. Thanks to both of you.

Status: Fixed » Closed (fixed)

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