This issue is created based on the documentation page Help contributed modules prepare for Drupal 9. It's not meant to be committed, but used as an ongoing issue to make deprecations visible.
1. Read Gábor Hojtsy's blog post on checking for compatibility with Drupal 9 as it provides a patch that applies to any module because it just adds a new file.
2. Create an issue in a module, name it "Test for deprecations" or so, then let the tests run with that patch. You might want to run it against latest core (currently 8.7.x) by adding an explicit test run as quite a few new deprecations messages have been added there. but you should be careful to only update deprecations that are safe to do for all supported drupal core versions, e.g. currently deprecated in Drupal 8.4.0 or earlier.
3. Based on the amount of results you get from that, you could either create a single new issue to update them all (should be fine for smaller modules) or split them up, e.g. if a module has a lot of db_* functions, or entity related stuff, you could group that together. Either way, you should do that in a new issue, because that allows to keep the "Test for deprecations" issue open, then that can simply be re-tested after the patches have been committed and then again some time later to see if there's new stuff.
4. If the module does not yet have an explicit dependency in its info.yml file, you should add that, e.g. "drupal:system (>= 8.5)" to make sure that people can't install the new version on an older core version.
Not everything does use @trigger_error() yet, but more and more does. Focusing on these things first also has the most benefit, because every @trigger_error() has a small performance impact as well.
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | 3035104-34.show-deprecations.patch | 483 bytes | jonathan1055 |
Comments
Comment #2
thallesFollow the patch!
Comment #3
thallesComment #5
jonathan1055 commentedThanks for this. You read my mind as I was about to do this - see #3033376: Add drupalci.yml test file to configure d.o. testing
I was planning to add a default drupalci.yml so when that is done I was going to make the change to run without hiding the deprecations.
The results above match my Travis test builds on
https://travis-ci.org/jonathan1055/scheduler/branches which is good.
By the way, the link in the issue summary does not work. I think you truncated the url.
Comment #6
jonathan1055 commentedNo that #3034805: Using setPublished() with a $published parameter is deprecated in 8.3 the number of deprecation fails should be lower.
Comment #8
thallesThe link broke in the last few days, then I'll check with @berdir, I think he can help with this.
Thanks!
Comment #9
jonathan1055 commentedFixed the link to Gábor Hojtsy's blog post.
Comment #10
jonathan1055 commentedNow that we have a default
drupalci.ymladded in #3033376-5: Add drupalci.yml test file to configure d.o. testing here is a patch which just adds the "suppress-deprecations: false" configuration option.Comment #12
jonathan1055 commentedHad 5 fails before, but now that #3034986: Replace deprecated SafeMarkup::checkPlain() is in, I've requeued the patch in #10
Comment #13
jonathan1055 commentedOf course, the drupalci.yml file has been changed since that last patch.
Comment #15
jonathan1055 commentedThat's good. We've removed the four deprecation fails from #3034986: Replace deprecated SafeMarkup::checkPlain() and now just have the one covered by
#3035911: EntityInterface::link() is deprecated, replace with EntityInterface::toLink()
Comment #16
jonathan1055 commentedHa! No sooner had we removed the last deprecation via #3035911: EntityInterface::link() is deprecated, replace with EntityInterface::toLink() then Core deprecate something else (almost exactly at the same time). Luckily I had two days of clean test results on TravisCi as I pushed the checkPlain() fixed there earlier than to d.o.
I have raised #3038746: Remove deprecated EntityDefinitionUpdateManagerInterface::applyUpdates() from hook_install and hook_uninstall for the new deprecation.
Comment #17
jonathan1055 commentedNow that #3038746: Remove deprecated EntityDefinitionUpdateManagerInterface::applyUpdates() from hook_install and hook_uninstall is done, we should get clean tests with no deprecation warnings. Re-queueing patch #13
Comment #18
jonathan1055 commentedSetting this to RTBC (even though the patch is not intended to be committed) just to see if that causes the patch to be automatically re-tested periodically.
Comment #19
thallesCongratulations @jonathan1055!
Comment #20
jonathan1055 commentedI re-ran the patch today and we had one failure, in DefaultTimeTest. The test failure is very likely to be due to #2957490: Default time tests fail in run-up to Daylight Saving clock change.
Comment #21
jonathan1055 commentedI've raised #3048600: Drupal::url() is deprecated, replace with \Drupal\Core\Url object for the latest failure.
Comment #23
jonathan1055 commentedFixed #3048600: Drupal::url() is deprecated, replace with \Drupal\Core\Url object and now the tests are green and all passing with no @trigger_error warnings.
Comment #24
jonathan1055 commentedRenaming to make this issue more distinct from #3042677: Drupal 9 Deprecated Code Report for Scheduler
Comment #25
jonathan1055 commentedNew deprecation #3059741: Replace deprecated entityManager() with entityTypeManager() which is now actually triggers a warning.
Comment #26
jonathan1055 commentedUsing PHP 7.1, MySQL 5.7, D8.8 On 5th June - working fine. 6th June - we get
Here is the same patch but with
index 9608ac7..b401dbf 100755manually changed toindex 9608ac7..b401dbf 100644Comment #27
jonathan1055 commentedOK that fixed the 100755/100644 problem but that was not the main thing. The patch still fails because this change is already in the drupalci.yml file - I committed it in #3059741-3: Replace deprecated entityManager() with entityTypeManager()
So, there is no patch here on this issue now. We can keep it open as a Meta issue if that is useful. We will get alerted to any deprecation triggers via the daily automated testing.
Comment #28
jonathan1055 commentedFixed #3086762: Change scheduler_api_test uid from entity_reference_autocomplete to number to avoid match_limit deprecation
Comment #30
jonathan1055 commentedI have reset the drupalci.yml config to
suppress-deprecations: trueas we do not really want the tests on drupal.org to be showing failures on the project front page whenever a new deprecation trigger is commited to core.https://travis-ci.org/jonathan1055/scheduler is set to alert me with a failure for any use of deprecated code, and will create child issues here to fix them.
Comment #31
kristen polPer a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.
Comment #32
jonathan1055 commentedFor info on #3079913: Add new 'core_version_requirement' key to .info.yml I have just committed this which adds
core_version_requirementto the two main module .info.yml files (not the test modules)Comment #33
jonathan1055 commentedAdding parent. Not all deprecations are for D9 but most are.
Comment #34
jonathan1055 commentedRe-rolled patch #26 to show deprecations
Comment #38
jonathan1055 commentedMoving to the 2.x branch to assist with Drupal 10 preparation
Comment #39
jonathan1055 commentedActually, this is all about Drupal 9 so marking this fixed.