Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3384 Add thumbnail image to Trellis Event importer #3761

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tadean
Copy link
Contributor

@tadean tadean commented Oct 9, 2024

Description

One limitation of our method of running migrations via the Batch UI is that it doesn't seem that multiple dependent migrations can easily be run. This is not ideal for purposes of media migrations, because normally nodes with media need a way to run dependent migrations to create their dependent media entities and files.

This PR introduces an experimental process plugin that inline creates media and file entities. To determine if the file has changed, it is compared to the existing value via hash value.

This PR is labeled a draft because, while feature complete, I think there are some remaining questions about implementation:

For review:

  • Is this approach sound?
  • Potential performance implications of fetching more outgoing web requests during batch
  • Should this become more generalized, for other integrations? (Profiles Integration #3362 )
  • Should this take place in an event subscriber rather than inside the migration itself?
  • Is this the wrong approach, and should we be using some kind of remote stream wrapper to include the integrated image as is from the original source, hot-linking it? (Downside: image derivatives would not be available)

Related issues

#3384
#3362 (Similar functionality is needed)

How to test

  • enable az_event_trellis and az_enterprise_attributes_import
  • navigate to /admin/trellis-event-importer
  • search for an import an event that has an image
  • verify whether the image was imported

Types of changes

Arizona Quickstart (install profile, custom modules, custom theme)

  • Patch release changes
    • Bug fix
    • Accessibility, performance, or security improvement
    • Critical institutional link or brand change
    • Adding experimental module
    • Update experimental module
  • Minor release changes
    • New feature
    • Breaking or visual change to existing behavior
    • Upgrade experimental module to stable
    • Enable existing module by default or database update
    • Non-critical brand change
    • New internal API or API improvement with backwards compatibility
    • Risky or disruptive cleanup to comply with coding standards
    • High-risk or disruptive change (requires upgrade path, risks regression, etc.)
  • Other or unknown
    • Other or unknown

Drupal core

  • Patch release changes
    • Security update
    • Patch level release (non-security bug-fix release)
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major or minor level update
  • Other or unknown
    • Other or unknown

Drupal contrib projects

  • Patch release changes
    • Security update
    • Patch or minor level update
    • Add new module
    • Patch removal that's no longer necessary
  • Minor release changes
    • Major level update
  • Other or unknown
    • Other or unknown

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires release notes.

@tadean tadean added Integrations This relates to an integration into a central service. editor experience Improvements to the editor experience for individuals editing Quickstart websites trellis Work associated with Trellis labels Oct 9, 2024
@tadean tadean self-assigned this Oct 9, 2024
@tadean
Copy link
Contributor Author

tadean commented Oct 21, 2024

Implemented @joeparsons suggestion of performing media download during a Queue task.

@joeparsons
Copy link
Member

Implemented @joeparsons suggestion of performing media download during a Queue task.

I like it! As we discussed, it would be cool if we could figure out a programmatically trigger a cron run in the background at the end of the migration but the possibilities for that look complicated. Having to wait for the next cron run definitely wouldn't be the end of the world IMHO. We'll probably just want to make sure to include a notice or some help text that indicates that more processing will happen later and probably update our Trellis Events documentation about this.

Comment on lines +14 to +20
* @QueueWorker(
* id = "az_deferred_media",
* title = @Translation("Quickstart Deferred Media"),
* cron = {
* "time" = 30,
* },
* )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @QueueWorker(
* id = "az_deferred_media",
* title = @Translation("Quickstart Deferred Media"),
* cron = {
* "time" = 30,
* },
* )
#[QueueWorker(
id: 'az_deferred_media',
title: new TranslatableMarkup('Quickstart Deferred Media'),
cron: ['time' => 30]
)]

Looks like QueueWorker plugins have been converted to attributes as of 10.3.0: https://www.drupal.org/node/3229001


use Drupal\Component\Utility\Crypt;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\Core\Queue\Attribute\QueueWorker;
use Drupal\Core\Queue\QueueWorkerBase;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor experience Improvements to the editor experience for individuals editing Quickstart websites Integrations This relates to an integration into a central service. trellis Work associated with Trellis
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants