Problem/Motivation

#3208681: Transform <img> tags used in formatted text fields to media embed or entity embed tokens and Linkit file links to D9 linkit links for every entity type is great but \Drupal\media_migration\Utility\SourceDatabase::getFormatsUsingTag() does not scale to

Steps to reproduce

Use a Drupal 7 source site with 100 node types and 20 text fields on nodes.

Proposed resolution

Add static caching.

Drastic performance improvement: generating the list of migration plugins now takes ~25 seconds instead of >10 minutes (unknown how long exactly).

Remaining tasks

None.

API changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB

Status: Needs review » Needs work

The last submitted patch, 2: 3214825-2.patch, failed testing. View results

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new1.12 KB
huzooka’s picture

Version: 8.x-1.0-alpha11 » 8.x-1.x-dev
huzooka’s picture

Status: Needs review » Needs work
+++ b/src/Utility/SourceDatabase.php
@@ -153,6 +153,20 @@ class SourceDatabase {
+    $cid = implode(':', [
+      $tag,
+      is_string($field_names) ? $field_names : implode(',', $field_names),
+      $source_entity_type_id ?: 'any_entity_type',
+      $source_bundle ?: 'any_bundle',
+    ]);

I know that it's an edge case, but I would rather see an array filter here instead of using default values when $source_entity_type_id and/or $source_bundle are empty.

huzooka’s picture

wim leers’s picture

Status: Needs work » Needs review
StatusFileSize
new740 bytes
new1.1 KB

Sure thing!

  • huzooka committed ca846cc on 8.x-1.x authored by Wim Leers
    Issue #3214825 by Wim Leers: Optimize SourceDatabase::getFormatsUsingTag...
huzooka’s picture

Status: Needs review » Fixed
huzooka’s picture

Status: Fixed » Closed (fixed)

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