2025 update - see this MR: https://git.drupalcode.org/project/wordpress_migrate/-/merge_requests/19
- Additional issue re body field picker needed in wizard #3516531: Add body field picker w default to wizard & processing
----
Old note. Problem/Motivation
Changes will periodically be added to this issue that remove deprecated API uses. To stop further changes from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD11" tag from the issue to stop the bot from posting updates.
The changes will be posted by the Project Update Bot official user account. This account will not receive any issue credit contributions for itself or any company.
Proposed resolution
You have a few options for how to use this issue:
- Accept automated changes until this issue is closed
If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD11" tag is left on this issue, new changes will be posted periodically if new deprecation fixes are needed.
As the Drupal Rector project improves and is able to fix more deprecated API uses, the changes posted here will cover more of the deprecated API uses in the module.
Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot changes. The bot will still post new changes then if there is a change in the new generated patch compared to the changes that the bot posted last. Those changes are then up to humans to integrate.
- Leave open but stop new automated changes.
If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated changes, remove the "ProjectUpdateBotD11" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated changes again, add back the "ProjectUpdateBotD11" tag.
- Close it and don't use it
If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated changes will be posted here.
If the issue is reopened, then new automated changes will be posted.
If you are using another issue(s) to work on Drupal 11 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.
Remaining tasks
Using the patches
- Apply the latest patch in the comments by Project Update Bot or human contributors that made it better.
- Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
- Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.
Using the merge request
- Review the merge request and test it.
- Thoroughly test the changes. These changes are automatically generated so they haven't been tested manually or automatically.
- Provide feedback about how the testing went. If you can improve the merge request, create a new branch and merge request and work from there.
Warning: The 'project-update-bot-only' branch will always be overwritten. Do not work in that branch!
Providing feedback
If there are problems with one of the changes posted by the Project Update Bot, such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue. For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue.
| Comment | File | Size | Author |
|---|---|---|---|
| #59 | wp-migrate-fix.zip | 2.34 KB | salvatoren 🇮🇹 |
| #49 | wordpress_migrate.3.x-dev.upgrade_status.post_rector.txt | 0 bytes | project update bot |
| #49 | wordpress_migrate.3.x-dev.rector.patch | 706 bytes | project update bot |
| #49 | interdiff-last-bot.7011390.txt | 1.35 KB | project update bot |
| #47 | Screenshot_20250407_212449.png | 85.04 KB | xpete |
Issue fork wordpress_migrate-3435726
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
project update bot commentedThis is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.
It is important that any automated tests available are run and that you manually test the changes.
Drupal 11 Compatibility
According to the Upgrade Status module, even with these changes, this module is not yet compatible with Drupal 11.
Currently Drupal Rector, version 0.20.1, cannot fix all Drupal 11 compatibility problems.
Therefore these changes did not update the
info.ymlfile for Drupal 11 compatibility.The compatibility issues that Upgrade Status found after the Drupal Rector fixes were applied are attached to help you resolve them manually.
Leaving this issue open, even after committing the current patch or merging the MR, will allow the Project Update Bot to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.
Debug information
These packages were used to generate the fixes:
Comment #4
project update bot commentedThis is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.
It is important that any automated tests available are run and that you manually test the changes.
Drupal 11 Compatibility
According to the Upgrade Status module, even with these changes, this module is not yet compatible with Drupal 11.
Currently Drupal Rector, version 0.20.2, cannot fix all Drupal 11 compatibility problems.
Therefore, these changes did not update the
info.ymlfile for Drupal 11 compatibility.The compatibility issues that Upgrade Status found after the Drupal Rector fixes were applied are attached to help you resolve them manually.
Leaving this issue open, even after committing the current patch or merging the MR, will allow the Project Update Bot to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.
Debug information
These packages were used to generate the fixes:
Comment #5
tolstoydotcomI've updated the module to D11 and kept D9 and D10 compatibility. I did one of the backwards compatibility issues differently than rector and found another similar issue. I lightly tested it on D9/D10/D11. The two methods I added at the end of SourceSelectForm can be changed once D9 is no longer supported.
I and someone in the Slack channel (https://drupal.slack.com/archives/C226VLXBP/p1726971471014629) had a problem where the protocol of the uploaded file was set to 'public://', but that wasn't resolved to 'http://'. I assume it was resolved in the past but behavior changed somewhere. I didn't look into that, I just changed the code to resolve the URL.
I also made a factory to create instances of WordPressMigrationGenerator and made that factory a service.
Comment #6
msielski@tolstoydotcom I was reviewing this work since this module is failing automated D11 testing.
FYI there is a related issue on the public protocol problem.
Your patch seems to be missing the definition of WordPressMigrationGeneratorInterface as well as a wordpress_migrate.services.yml
Comment #7
tolstoydotcomThat's odd, I'll update it tomorrow. I'll also test out #5 on the other thread.
An abridged def is:
namespace Drupal\wordpress_migrate;
interface WordPressMigrationGeneratorInterface {
public function createMigrations(array $configuration): void;
}
and the services file:
services:
wordpress_migration_generator_factory:
class: Drupal\wordpress_migrate\WordpressMigrationGeneratorFactory
arguments: ['@entity_field.manager', '@plugin.manager.migration', '@file_url_generator']
Comment #8
hongpong commentedThank you tolstoydotcom , thanks to msielski we should be clear of public protocol issue. #3484883: Protocol "public" not supported .
Open to advice about best move here w D11.
Comment #9
tolstoydotcomI can rework my patch to have the missing parts, it does work on D11.
However: the rector patch uses the backwards compatibility layer. My patch instead tests if things are available. That's not an issue if you don't want to support D9.
Should I post a new patch?
Comment #10
hongpong commentedI am pretty unfamiliar with the backwards compatibility layer to be honest. I think we should probably hold onto Drupal 9 support if possible. Thank you.
Comment #11
ressaThanks everyone for working on this. "hold onto" means keep doing something, which slightly contradicts the first part of the sentence ... But I assume the decision is "No D9 support"?
I think that will be fine. After all, Drupal 9 reached end of life November 2023 https://www.drupal.org/about/announcements/blog/drupal-9-is-end-of-life.
Comment #12
hongpong commentedThat is fair enough ressa regarding D9 EOL. Maybe the best move is, tag another release as "the last D9 supported release", and after that, include this patch.
Comment #13
tolstoydotcomHere's an updated patch. It should work with D9/D10 but I only tested D11 this time.
Comment #14
msielski@tolstoydotcom I tried applying the patch against wordpress_migrate 3.x-dev@dev but it failed to apply. Do you have other patches applied?
Composer gives me the error:
A src/WordPressMigrationGenerator.php.rej file was generated with the conflicts:
Comment #15
tolstoydotcomIf you clone https://git.drupalcode.org/project/wordpress_migrate the patch should apply cleanly.
Comment #16
ressaMaybe use a Gitlab fork, to streamline the process?
Comment #17
tolstoydotcomAFAIK, the link in my last comment is where the latest code is. If anyone wants to test it, just:
Comment #18
msielski@tolstoydotcom, thank you, I was testing against the dev branch. Patch applied fine for me against 8.x-3.x and everything is working well on Drupal 10.3.6.
Comment #20
hongpong commentedOkay I fumbled around a bit (issue forks are a little tricky) on MR 19 but I think this encompasses your changes tolstoydotcom and a few small small type-safety changes. I think we can roll this in unless someone catches an issue that needs attention.
One flag still in there : (link)
\Drupal calls should be avoided in classes, use dependency injection instead
File wordpress_migrate_ui/src/Wizard/ImportWizard.php:83
Comment #21
hongpong commentedComment #22
hongpong commentedIt will need a re-roll against 8.x-3.x head and ideally cleaning up a few of those flags, which may need some more dependency injection added in constructors to get rid of \Drupal calls. There is currently a merge conflict popping up.
Comment #23
tolstoydotcomI count five instances of \Drupal:
- in README.md. I don't think that should be replaced
- in a drush function. Unless that's changed to use classes, that can't be injected.
- in SourceSelectForm. I didn't inject that because getFileValidators will be reworked so the Drupal call is no longer needed once the module doesn't support D9
- in ImportWizard. I don't know if there will be a conflict with how ctools does things. If there is, this might have to remain.
- in ImageSelectForm. I can replace that.
I'll post another patch over the weekend that deals with the last two items.
Comment #24
ressaIncreasing Priority, since it is placed under "Major issues" header in #2904990: Plan for wordpress_migrate 8.x-3.x beta release, so I am also adding that as parent issue.
Comment #25
hongpong commented@tolstoydotcom and @ressa thank you for digging around this weekend. It was suggested to me by @dinarcon that we could split up the patch (MR19) to simplify matters somewhat by moving the new interfaces / service / factory / validator over to that issue (unless they are absolutely necessary to get Drupal 11 working).
I have filed a new issue #3489412: Refactor / split up Wordpress generator (service, factory and validators) to cover these things. If that is objectionable or duplicative I would say, alright let's proceed as we have been - and I would change the new issue to cover a smaller refactoring. However I think this will be helpful to consider.
Regarding dropping Drupal 9 and the file API issues you mention maybe this is an indicator we should actually tag a final D9 compatible release before adding this D11 patch. I am not against that.
Also dinarcon pointed out that we have broken Drush 8 code inside 8.x-3.x currently and I think at a minimum we should comment out the code, probably on this issue / patch, because it is inoperative and throwing CI notices for being so wildly out of date. Then drush 12+ coverage could be re added, dinarcon suggested in a new issue which makes sense to me since that is years different than the existing drush thread.
Comment #26
tolstoydotcomI based this on the latest dev version. I injected services in the last two places I listed in #23. I didn't deal with the drush code. It'd be great if we could freeze changes to dev for a while, test the patch on D9/D10/D11 (I only tested in on D11), and then deal with drush etc.
To use:
Comment #27
hongpong commentedOh this is really looking look great. Thank you for this elegant workaround for D9. I think we can just tag the final D9 release before applying your patch. I can test it on D10 and D9 tomorrow as well. (not tested yet)
Hoping we can get a fix on duplicate users (#3123393: Users are duplicated (Integrity constraint violation) Duplicate entry) before tagging the next release.
on SourceSelectForm.php . the IDE doesn't like !empty but I think 'isset' is a little better.
if (isset($constraint_definitions['FileExtension'])) {Also I was able to get a TypedDataManager in the __construct() here to replace the \Drupal notice in getFileValidators.
on ImportWizard.php $tempstore_id needs a parameter type.
Thank you for working through this as I reshuffle a bunch of stuff and try to get nearby code fixes in there. Also I removed the broken drush code tonight earlier so it's out of the way. I think we can freeze for a day or 2 unless someone has a quick fix for duplicate users. Really appreciate all this work.
Comment #28
hongpong commentedhere is the patch with a few adjustments noted above. MR is now updated. Awesome stuff thank you!
Comment #30
baltowen commentedI pushed a commit to fix coding standard issue, please review.
Comment #31
hongpong commentedThank you baltowen I was also wondering about that one and not sure if it is a string but, if it works it is probably fine.
I am going to cherry pick some of the smaller changes out of this patch to apply before the larger patch on D11 so we can get some of it into the next tagged release this week alpha7 - things which ware not part of the 'big reworking' but just involve smaller changes, and dependency injection, and are still Drupal 9 compatible. New issue for these: #3489725: Dependency injection and access check
Also I have updated the "plan" again to clarify we will drop D9 + D10.1 support going into alpha8, which will make this patch a lot easier to deal with juggling the APIs and so on.
I will also try and get some more testing. We are nearly there folks!
Comment #32
baltowen commentedYes,
$tempstore_idis astringSee https://git.drupalcode.org/project/ctools/-/blob/8.x-3.x/src/Wizard/Form...Comment #33
hongpong commentedOkay I have been able to finish the cherrypicking of several items from this issue into 8.x-3.x, and then rebased the MR to match the new 8.x-3.x, which has scaled down the size of the rest of the patch at least a good ways. Thanks for bearing with me, I won't do any more cherry picking from here. Excellent work everyone!!
re SourceSelectForm typed data manager dependency injection. the IDE does not like something about it, I didn't really understand so I didn't cherrypick that item.
Comment #36
dinarcon commentedThe last pipeline was failing. It looks like during a merge @baltowen's phpcs fix was lost. I cherry-picked c636be41 and pushed. This should make phpcs pass.
Comment #37
dinarcon commentedTested the latest code and was getting a fatal error when starting the wizard at
/admin/structure/migrate/wordpress_migrateI pushed a new commit passing the missing parameter.
Comment #38
project update bot commentedThis is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.
It is important that any automated tests available are run and that you manually test the changes.
Drupal 11 Compatibility
According to the Upgrade Status module these changes make this module compatible with Drupal 11! 🎉
Therefore these changes update the
info.ymlfile for Drupal 11 compatibility.Leaving this issue open, even after committing the current patch or merging the MR, will allow the Project Update Bot to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.
Debug information
These packages were used to generate the fixes:
Comment #40
xpete commentedTested this with Drupal CMS 1.0.2 and the posts titles are imported but the content is ignored. Tried this branch on Drupal 10.4 and had the same issue.
Comment #41
hongpong commentedI think we can bring the patch in. I am testing in Drupal 10.4 11.0 11.1 to put it to bed to this point.
However re xpath note I believe we need a better body field picker in Drupal 11.1 (similar to the other field pickers in the wizard) . New issue added #3516531: Add body field picker w default to wizard & processing. It works in Drupal 10.4 and 11.1 with the default 'body' field but it doesn't warn the user if this situation isn't connected.
Also I've seen the migration paginator skip back to the migrate machine names setter page. It still seems to be saving fine but there is a kink there imo (in 11.0 and 11.1 i think). [could be a form cache issue also] I think that is probably #3489999: Subtle wizard pagination bug posts/pages, remove "empty".
Everything else appears to be solid so I am pulling this in, then we can move to other refactoring and the plugin architecture, & so on.
I think we could still put changing logger statements into injected service, into this issue. (and then change the required drupal core version to >=10.3
Comment #42
hongpong commentedComment #43
hongpong commentedComment #45
xpete commentedI tested the 8.x-3.x branch again with version Drupal 10.4.6 and Drupal CMS 1.1.0. It's fixed on version 10.4.6 but with Drupal CMS the Blog and Page fields are not visible on the body field picker so the body still can't be imported.
Comment #46
hongpong commentedThank you for testing xpete! can you confirm if it is a "text_with_summary" type of body field? (screenshot if needed).
Also i created a Drupal CMS "recipe" module here last week but not tested it yet - i don't have a good drupal CMS test process https://www.drupal.org/project/wordpress_migrate_recipe
Comment #47
xpete commentedDrupal CMS don't use text_with_summary. It uses regular text fields. You can read a discussion about it here https://www.drupal.org/project/drupal/issues/3477043
You should follow the instructions to setup a local Drupal CMS installation.
Comment #48
hongpong commentedOK xpete I will re open the other issue #3516531: Add body field picker w default to wizard & processing to address the body field issue. I would still like to add some exception handling here on this issue before closing it
re what else goes in next alph tagging the release: assuming nobody is going to nudge ahead on #3173973: Pluggable extension, support contrib + custom WordPress, Yoast SEO which is close but I am trying to extend its functionality to preprocess -- and that is not a 11.x blocker at all so it should not hold up tagging for 11.x. i think this body field thing ought to be done before tagging the release tho.
Comment #49
project update bot commentedThis is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request (MR) is also openend and updated.
It is important that any automated tests available are run and that you manually test the changes.
Drupal 11 Compatibility
According to the Upgrade Status module, even with these changes, this module is not yet compatible with Drupal 11.
Currently Drupal Rector, version 0.20.3, cannot fix all Drupal 11 compatibility problems.
Therefore, these changes did not update the
info.ymlfile for Drupal 11 compatibility.The compatibility issues that Upgrade Status found after the Drupal Rector fixes were applied are attached to help you resolve them manually.
Leaving this issue open, even after committing the current patch or merging the MR, will allow the Project Update Bot to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.
Debug information
These packages were used to generate the fixes:
Comment #50
salvatoren 🇮🇹 commentedScreenshot
Hi, I'm here just for this issues.
Tomorrow, if can be useful, I can provide more info. Ty.
Comment #51
salvatoren 🇮🇹 commentedOk, thanks to Claude Ai i maked a custom module to fix this issue and now I can import as expected both body and featured image, but featured image are present in filesystems, but not present in Drupal media gallery ATM.
Is there any guide to import as best as possible.
I need to import in some specific order?
Eg: post, tag, images, comments can be ok?
Thanks.
Comment #52
ressaGreat that you got it working!
Did you already check "Documentation" and "Readme" under Resources on https://www.drupal.org/project/wordpress_migrate?
Comment #53
salvatoren 🇮🇹 commented@ressa, yep,.I searched in faq page. But cannot found anything about import order. Ty.
Comment #54
ressaThanks for a fast response. I skimmed the README, and the only mention of order seems to be images before Posts, under https://git.drupalcode.org/project/wordpress_migrate/-/blob/8.x-3.x/READ....
There will probably be more who wonder about this, so perhaps you can create a new issue to clarify this, and then add the answer in the FAQ page, or README, possibly under a new "Recommended order of import" section?
Comment #55
salvatoren 🇮🇹 commentedTy too ressa. Today I try again. ✌️
Comment #56
salvatoren 🇮🇹 commentedI tried, but when I import images, I can see in FTP (not in Drupal media center). Then, when I import post all are without images.
Launched a fix to update media from folder, now I can see (but I just need to set again in post).
Also, comments seems to be not imported at all.
So, isn't a great migration 😥
Comment #57
ressaThanks for testing this patch, too bad it seems to not work ... in that case, it seems like the status should be changed to "Needs work".
It would be valuable if you shared your steps, to make it clearer where and how it fails. Like:
a_file_in_the module.phpwith ...But the best would be some feedback from the other developers here who supplied patches (@dinarcon, @xpete, @hongpong, etc.) since they know best what to look out for.
Comment #58
salvatoren 🇮🇹 commentedTo be honest, my WP contain just about 50 articles, only a member (me) as admin, and some post with a lot of comments. I hope to can make a clean migration asap. Write all by hands require a lot of work and I don't have time for this 😅
ATM I just imported articles and comments, but all comments are with my name (so, I still need to edit all).
Anyway, this module ATM isn't ready for Drupal CMS 11.
Comment #59
salvatoren 🇮🇹 commentedThis is a small extra modules fix.
Anyway, migration still need a lot of work.
ATM I've a custom php script and can import also description, fix image URL, clean html.
Comment #60
hongpong commentedI think this is resolved now? I applied the
formatByteSizeauto patch it wanted. Let's open more narrowly tailored new issues if things continue to be a problem. Thank you salvatoren for throwing in an alternative system.Comment #63
hongpong commentedAs we discussed earlier support for Drupal 9 and 10.1.x is now removed in both the info.yml files which will let us tailor efforts better. (meant to do this on the release yesterday but forgot!)
Comment #64
hongpong commented