Problem/Motivation
drupal-check results on commit hash: 3a623de259a2482d4a23015051f5172c634c6abb
------ ----------------------------------------------------------------
Line memcache_admin/src/Controller/MemcacheStatisticsController.php
------ ----------------------------------------------------------------
55 Call to deprecated function drupal_set_message().
79 Call to deprecated function drupal_set_message().
84 Call to deprecated function drupal_set_message().
224 Call to deprecated function drupal_set_message().
------ ----------------------------------------------------------------
[ERROR] Found 4 errors
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | drupal_9_deprecated_code_report-3042707-15.patch | 4.62 KB | jcnventura |
| #15 | interdiff_8_15.txt | 4.36 KB | jcnventura |
Comments
Comment #2
sergiu stici commentedI replaced drupal_set_message() with Drupal Messenger service.
Here is the patch.
Comment #3
manuel garcia commentedPersonally, I think using the
MessengerTraitwould be a less disruptive change, though in this case it is probably safe to change the parameters for this class as I doubt someone else is extending it.Comment #4
jhuhta commentedFixed the messenger once more.
Also, added the required core_version_requirement strings and fixed a typo.
Comment #5
holist commentedChanges check ok.
Comment #6
margaritka.kurkul commentedHello, after running drupal-check 02/04/2020
Commit: 3a623de259a2482d4a23015051f5172c634c6abb
Drupal version: 8.8.2
PHP: 7.2
Comment #7
manuel garcia commentedRe #6 - There are no
drupal_set_message()uses in the module after applying the patch on #4.RTBC++
Comment #8
nikolas.tatianenko commentedHi all,
I've updated solution in comment #4,
"Memcache 8.x-2.0-dev" Scanned on Sat, 02/08/2020 - 19:03.
No known issues found.
Please review.
Comment #9
nikolas.tatianenko commentedComment #10
manuel garcia commentedThanks @nikolas.tatianenko for working on this :)
I do have one concern with the latest patch:
This is a BC breaking change, and any custom cache backends that people may have implemented extending this class would need to be updated or they will break. Could easily be avioded by not injecting the service and just using
\Drupal::time()->getRequestTime();Up to the maintainers on how to deal with this, just wanted to point it out :)
Comment #11
holist commentedGood point by @Manuel Garcia. In Drupal 8 core though, constructors are considered internal and are not guaranteed to change: https://www.drupal.org/core/d8-bc-policy while not using dependency injection is strongly discouraged.
Some discussion on alternative approach to constructor overrides here: https://www.previousnext.com.au/blog/safely-extending-drupal-8-plugin-cl...
But yes, maintainer call in the end.
Ran drupal-check on #8, all clear, RTBCing.
Comment #12
jmoreira commentedSame here.
Comment #13
heddn+1 on rtbc. Although seeing MemcacheLockFunctionalTest in src/Tests looked very much like it was a Simpletest. And that isn't true. So we could move it. But that isn't strictly necessary for 9.x compatibility.
Comment #14
jcnventuraJust added #8 to a running Drupal 9.0-beta2 site that without Memcache configuration runs fine. When I enable the config that I use on the production (running 8.8.5) I get a WSOD and the following stack trace:
In the REAME.txt file on how to install this module, you have instructed people how to use "Cache Container on bootstrap (with cache tags on database)", which I followed. I don't believe it is possible to use the cache container on bootstrap and to pass along the @datetime.time service to MemcacheBackend, as this service doesn't exist yet at that time.
I'll provide a patch that removes this dependency injection and seems to work fine in my case. I suggest that if the maintainers wish to decide on having this dependency injection, this MUST be a BC break, and the module must switch to version 3.x.
Comment #15
jcnventuraComment #16
holist commentedInstead of removing the services, I think it would be better to use the pattern that is outlined in https://www.previousnext.com.au/blog/safely-extending-drupal-8-plugin-cl..., as that does not break on parent constructor changes.
Comment #17
japerryFixed for the messenger. Removing the Time service for now, it is handled in this issue: #2999614: Update REQUEST_TIME call