Created on 29 September 2020, over 4 years ago
Updated 31 March 2023, almost 2 years ago

Problem/Motivation

Is there any way to import the attachments as Media if the module from Drupal core is enabled?
The files interface in Drupal is very bad and worpress interface for the images are Media as well, it would make sense to import them as media as well in Drupal.

Steps to reproduce

Proposed resolution

Add a step for the attachment to pick if you want to import them as images or media and configure it.

Remaining tasks

Support other types of media based on the extension of the files.

User interface changes

Add an extra step with the selection about the attachments. I also made the path for the files configurable instead of being fixed to featured_image.

API changes

Data model changes

✨ Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada phjou Vancouver πŸ‡¨πŸ‡¦ πŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡»πŸ‡³Vietnam linhnm

    Rerolled patch from #10

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    Can anyone else check this one out and give it RTBC? Thank you!

  • πŸ‡¬πŸ‡·Greece bserem

    None of the latest patches apply anymore. Trying to apply them by hand ends in deprecation warnings.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    I added a few type safety updates flagged in the IDE. Otherwise should be a clean re-roll against today's 8.x-3.x. i saw the WordPressMigrationGenerator "path alias generator" part, I think the reroll patch here is correct but should be double checked.

    (the MR !21 is the same as this patchfile.)

    I applied it using patch -p1 < 3173916-11.patch from the base dir of the module as working directory. This helps deal with stuck hunk patch application. I did not test this but wanted to give people a clean spot to start again with this issue.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    Oops - my local 8.x-3.x was missing the latest "path alias generator" commit. re rolled again.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    some more notices. Per !MR21 reroll . https://git.drupalcode.org/project/wordpress_migrate/-/merge_requests/21

    Major - Access to an undefined property Drupal\wordpress_migrate\WordPressMigrationGenerator::$mediaAudioID.
    in src/WordPressMigrationGenerator.php:167

    Major - Access to an undefined property Drupal\wordpress_migrate\WordPressMigrationGenerator::$mediaDocumentID.
    in src/WordPressMigrationGenerator.php:167

    Major - Access to an undefined property Drupal\wordpress_migrate\WordPressMigrationGenerator::$mediaImageID.
    in src/WordPressMigrationGenerator.php:167

    And additional phpstan and phpcs notices.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    Some upstream changes in wordpress_migrate_ui/src/Form/ImageSelectForm.php - the merge conflict is only there, basically got similar modernization by other folks. I'm not actively going to tangle with this one more for now, but if someone else wants to hammer away on it, go ahead.

  • First commit to issue fork.
  • πŸ‡ͺπŸ‡ΈSpain abarrio

    Created a new MR with branch 3173916-import-as-media rebased to 8.x-3.x.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 145s
    #376959
  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    Thanks so much abarrio for rebasing. Any ideas what we can do to fix the "Access to an undefined property" stuff flagged above? That seems like the biggest flagged snag currently.

  • πŸ‡ͺπŸ‡ΈSpain abarrio

    Uploaded a fixing for the undefined property error and fixing some other coding standards on WordPressMigrationGenerator.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 323s
    #378448
  • Pipeline finished with Failed
    about 1 month ago
    Total: 152s
    #379641
  • Pipeline finished with Failed
    about 1 month ago
    Total: 153s
    #379657
  • πŸ‡ͺπŸ‡ΈSpain abarrio

    Uploaded one fix for an undefined index url error when executing drush ms and changed xpath expressions on media migrations with a simpler one.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    excellent stuff abarrio. do you think it is RTBC yet? I don't have a test xml with audio attachment to test.

  • πŸ‡ͺπŸ‡ΈSpain abarrio

    No, I think there is more work remaining to have it as RTBC.
    I think we still need to work on:

    • Test each media type to check that is completely working automatically without changing yml
    • Fix coding standard of all new code
    • Maybe be able to check if xml file is completely correct to avoid problems when importing (Maybe could be done on a follow up issue)
    • Create some unit tests
    • Fix all problems that appears on merges

    I think with this points resolved we can proceed with this as RTBC.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    regarding checking the xml file see #3248042: Add XML Lint to check the WordPress exports β†’ xml lint could be added to composer but i figured that would intensify requirements. as well as ✨ WP import xml entities & security considerations Active for a note on other considerations.

    regarding testing media types I suppose this would require a new test site altogether with the types of assets in question.

    if you think we can subdivide out any portion of the patch as well (in other words if you think some standalone portion would actually be RTBC as it is), let me know. Thanks for all this!

  • πŸ‡ͺπŸ‡ΈSpain abarrio

    Makes sense to me.

    Maybe we can merge and complete this issue as a first approach and then continue working on some other issues to finish this big development part.

    I think we need a meta issue with a complete list of tasks needed to finish it. If I have time this days I'll create it.

  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia
  • πŸ‡ͺπŸ‡ΈSpain abarrio

    that's completely true!!
    The only yml files that needs to be there are the ones from migrations folder.

  • πŸ‡ͺπŸ‡ΈSpain abarrio

    Removed unnecessary yml files from MR.
    As I said on #26 I think we should work on those points but maybe we can proceed with this as a first approach and them complete the development in a follow up issue.

  • Pipeline finished with Failed
    24 days ago
    Total: 164s
    #388562
  • πŸ‡ΊπŸ‡ΈUnited States hongpong Philadelphia

    Regardless of the 'nice to have' like xml check, unit tests and certain code standard flags, I think we need to be assured that the migration is working correctly for most use cases.
    Forgive my silly question but is "document" like PDF files and things of that nature? In other words if someone has added a plugin that allows the PDF uploads in the media library, this would cover importing those. I'm a little more familiar with the built in audio content type.

  • πŸ‡ͺπŸ‡ΈSpain abarrio

    Actually on each media is getting the default type and checking the extensions allowed there to get default value when configuring migration:

    it is not different between types of attachment files, it is just getting them to drupal files and then converting it into media.

  • leymannx Berlin

    Need a static patch of the current state of MR 35. Thank you for your work so far πŸ€—

Production build 0.71.5 2024