Comments

Berdir created an issue. See original summary.

berdir’s picture

Issue tags: +Novice
fconnolly’s picture

I'm going to take a swing at this. Should the class be replaced by anything in ApcuBackendFactory? Or should an error be raised?

fconnolly’s picture

Assigned: Unassigned » fconnolly
cilefen’s picture

fconnolly’s picture

StatusFileSize
new819 bytes

I've uploaded a test patch. I believe I've deprecated the class the correct way, and that is the only change I've made. However, the project does not pass the tests on my local machine. I don't believe that just deprecating a function should break any tests? So I'm uploading for feedback/clarification. I also have not changed any of the actual code in Apcu4BackendFactory as I couldn't properly test any of my changes

berdir’s picture

Status: Active » Needs work

Not sure which tests you did run, but this would only be loaded on PHP 5, if tests failed that might have had other reasons.

The other thing you need to do is remove the code in ApcuBackendFactory that conditionally uses this class.

fconnolly’s picture

StatusFileSize
new1.64 KB

I've removed the conditional usage in ApcuBackendFactory. Also just to clarify, Apcu v4 would only be used if the user has PHP 5 or less, and Drupal 8.8.x no longer supports PHP 5, so it's safe to remove it?

Also, I tried looking in the composer.json file a little bit and didn't see anything about apcu v4, but do we need to including the apcu v4 extension somewhere in the source code?

fconnolly’s picture

StatusFileSize
new2.53 KB

Fixed a coding style error. Also updated the ApcuBackendTest class, didn't realize it tested the version separately instead of using the factory

fconnolly’s picture

StatusFileSize
new8.44 KB

Removed use statement from ApcuBackendtest

fconnolly’s picture

Status: Needs work » Needs review
fconnolly’s picture

berdir’s picture

Status: Needs review » Needs work
diff --git a/core-deprecate-Apcu4Backend-3058498-6.patch b/core-deprecate-Apcu4Backend-3058498-6.patch
new file mode 100644

new file mode 100644
index 0000000000..7d66fd481b

index 0000000000..7d66fd481b
--- /dev/null

--- /dev/null
+++ b/core-deprecate-Apcu4Backend-3058498-6.patch

+++ b/core-deprecate-Apcu4Backend-3058498-6.patch
@@ -0,0 +1,21 @@

looks like you included the older patch files into the patch.

fconnolly’s picture

StatusFileSize
new2.67 KB

Ah, sorry, it's my first time using patches, I committed the older patch files in the issue branch. Fixed. Thanks for your patience

fconnolly’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 14: core-deprecate-Apcu4Backend-3058498-14.patch, failed testing. View results

fconnolly’s picture

Status: Needs work » Needs review
berdir’s picture

Status: Needs review » Needs work
+++ b/core/lib/Drupal/Core/Cache/Apcu4Backend.php
@@ -2,10 +2,16 @@
 
+@trigger_error(__NAMESPACE__ . '\Apcu4Backend is deprecated in Drupal 8.8.x Apcu 4 was built for PHP 5 and
+ Apcu 5 is built for PHP 7+. Use ApcuBackend instead');
+
 /**
  * Stores cache items in the Alternative PHP Cache User Cache (APCu).
  *
  * This class is used with APCu versions >= 4.0.0 and < 5.0.0.
+ * @deprecated Apcu4Backend is deprecated in Drupal 8.8.x Apcu 4 was built for PHP 5 and
+ * Apcu 5 is built for PHP 7+. Use ApcuBackend instead
+ * @see ApcuBackend
  */
 class Apcu4Backend extends ApcuBackend {

The code changes themself look good, but we need to improve wording and spacing a bit here.

Id' keep the @trigger_error() on a single line, even if it is long.

The part inside the docblock with @deprecated must not be more than 80 characters however and needs a line break earlier.

We should also have an empty line above the @deprecated and above the @see. and the @see needs to use the full namespace.

I fear we also have pretty strict rules on having change records, even when there's really nothing else to say, so we need to create one with the add link on https://www.drupal.org/list-changes/drupal. And then link to that in the @see below and with See ...

I'm not sure if we need the part with "Apcu 4 was built..", I'd just leave that out. Suggestion: ...\Apcu4Backend is deprecated in drupal:8.8.0 and will be removed from drupal:9.0.0. Use ApcuBackend instead. See link-to-change-record"

Same text for @deprecated, except there the See link part is a separate @see.

leolandotan’s picture

Assigned: fconnolly » leolandotan

I'll try to work on this and create an initial change record as well.

leolandotan’s picture

Issue tags: +Needs change record

I added the "Needs change record" tag based on the recommendation of @Berdir.

leolandotan’s picture

Assigned: leolandotan » Unassigned
Status: Needs work » Needs review
StatusFileSize
new2.9 KB
new1.36 KB

I have added the changes based on @Berdir's recommendations and tried to follow a deprecation pattern from other issues. I have also created a change record for your review.

Hope everything is in order.

Thanks!

yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar
yogeshmpawar’s picture

StatusFileSize
new2.77 KB
new1.32 KB

I have updated the deprecation message as per the format & Agree with @berdir suggestion over to remove "Apcu 4 was built.." part. Added an interdiff as well.

yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
StatusFileSize
new2.79 KB
new784 bytes

Missed one thing in the previous patch so added back with an interdiff.

Status: Needs review » Needs work

The last submitted patch, 24: 3058498-24.patch, failed testing. View results

yogeshmpawar’s picture

Status: Needs work » Needs review

Above JS test fails are unrelated.

init90’s picture

StatusFileSize
new2.71 KB
new1.18 KB

I've corrected some moments in deprecation message. Also, I decided use deprecation message format suggested by @berdir in comment #18, because it seems more relevant for our case.

init90’s picture

Issue tags: -Needs change record

I've updated CR.

init90’s picture

StatusFileSize
new2.73 KB
new1.06 KB

I've changed deprecation format(one more time:), according to: Adopt consistent deprecation format for core and contrib deprecation messages

fconnolly’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me! :+1:

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed fa4c517 and pushed to 8.8.x. Thanks!

  • catch committed fa4c517 on 8.8.x
    Issue #3058498 by fconnolly, yogeshmpawar, init90, leolando.tan, Berdir...
catch’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.