drupal-check web/modules/contrib/prlp     4/4 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ---------------------------------------------------------------------- 
  Line   prlp.module                                                           
 ------ ---------------------------------------------------------------------- 
  31     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   src/Controller/PrlpController.php                                     
 ------ ---------------------------------------------------------------------- 
  36     Call to deprecated constant REQUEST_TIME: Deprecated in drupal:8.3.0  
         and is removed from drupal:9.0.0. Use                                 
         \Drupal::time()->getRequestTime();                                    
  52     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
  75     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
  81     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
  99     Call to deprecated function drupal_set_message():                     
         in drupal:8.5.0 and is removed from drupal:9.0.0.                     
         Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.  
 ------ ---------------------------------------------------------------------- 

                                                                                
 [ERROR] Found 6 errors                                                         
                                                                                

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Vernit created an issue. See original summary.

simgui8’s picture

Here is a patch

simgui8’s picture

FileSize
3.38 KB
simgui8’s picture

Version: 8.x-1.3 » 8.x-1.x-dev
Priority: Critical » Normal
Status: Needs work » Needs review
alonaoneill’s picture

Status: Needs review » Reviewed & tested by the community

Code looks good.
Patch applied!

JeroenT’s picture

Title: Deprecated drupal_set_message() with the newer method » Drupal 9 Deprecated Code Report
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: +Drupal 9 compatibility

Great job @simgui8, once we are at it, we can probably also remove the deprecated usage of REQUEST_TIME.

JeroenT’s picture

Issue summary: View changes
simgui8’s picture

FileSize
3.73 KB

Rerolled plus #6 (replace deprecated REQUEST_TIME)

JeroenT’s picture

+++ b/src/Controller/PrlpController.php
@@ -48,7 +48,7 @@ class PrlpController extends UserController {
+        \Drupal::messenger()->addError($this->t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));

@@ -71,13 +71,13 @@ class PrlpController extends UserController {
+      \Drupal::messenger()->addError($this->t('You have tried to use a one-time login link that has expired. Please request a new one using the form below.'));
...
+      \Drupal::messenger()->addStatus($this->t('You have just used your one-time login link. It is no longer necessary to use this link to log in.'));

@@ -87,7 +87,7 @@ class PrlpController extends UserController {
+    \Drupal::messenger()->addError($this->t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'));

Since we're in a controller we can replace this by $this->messenger()->addError() and $this->messenger()->addStatus().

simgui8’s picture

@JeroenT

Does that applies to any Drupal service placed in a controller ?

simgui8’s picture

FileSize
3.72 KB

Answer to myself: no

Here is an updated patch!

ankushgautam76@gmail.com’s picture

@simhgui8

patch failed to apply :

Checking patch prlp.module...
Checking patch src/Controller/PrlpController.php...
Hunk #1 succeeded at 33 (offset 1 line).
Hunk #2 succeeded at 49 (offset 1 line).
Hunk #3 succeeded at 72 (offset 1 line).
error: while searching for:
);
}

drupal_set_message($this->t('You have tried to use a one-time login link that has either been used or is no longer valid. Please request a new one using the form below.'), 'error');
return $this->redirect('user.pass');
}
}

ankushgautam76@gmail.com’s picture

Status: Needs work » Needs review
FileSize
4.87 KB

Adding updated patch !

simgui8’s picture

Hello ankushgautam76@gmail.com,

#11 should pass on latest dev (not on stable 1.4)

Jitesh Doshi’s picture

Thank you all. I'll review and commit these in due course of time.

jcnventura’s picture

Status: Needs review » Needs work

This patch should also add the core_version_requirement information to the .info.yml file of the module.

ridhimaabrol24’s picture

Assigned: Unassigned » ridhimaabrol24
ridhimaabrol24’s picture

Assigned: ridhimaabrol24 » Unassigned
Status: Needs work » Needs review
Issue tags: +Drupal 9 porting weekend, +DIACWMay2020
FileSize
5.29 KB

Added core_version_requirement in the patch.

drupalviking’s picture

Assigned: Unassigned » drupalviking

Reviewing latest patch

drupalviking’s picture

Status: Needs review » Reviewed & tested by the community

Patches reviewed and tested.

drupalviking’s picture

Assigned: drupalviking » Unassigned
jcnventura’s picture

FileSize
4.4 KB
435 bytes

The recent security release fixed all the D9 deprecations.. It's only a shame that it didn't add 'core_version_requirement' to the .info.yml file.Not changing the RTBC because

Jitesh Doshi’s picture

Assigned: Unassigned » Jitesh Doshi
Category: Bug report » Task
Status: Reviewed & tested by the community » Fixed

I have committed the info.yml file fix to the 8.x branch. But I'm not sure what I have to do to make 9.x release. Should I just make a 8.x release and it will automatically be usable for 9.x or do I need to add a Git tag for 9.x and make a separate release?

JeroenT’s picture

Thanks @jitesh Doshi!

You can create a new 8.x release as you did for The previous releases: https://www.drupal.org/docs/updating-drupal/how-to-prepare-your-drupal-7...

jcnventura’s picture

@Jitesh Doshi, it is good practice to credit patch authors even if the patch is so simple that you can just copy+paste it from somewhere else. In this case, @ridhimaabrol24 and me provided patches more than 20 days ago for that one line you committed yesterday. Not that you need to do something now, just a request to be nice to the community in the future.

Jitesh Doshi’s picture

Sorry, I didn't understand how the credit system works (I still don't). And now when I'm trying to amend the commit message and "git push -f" the git server is rejecting it.

Jitesh Doshi’s picture

Status: Fixed » Closed (fixed)

8.x-1.6 released.