Comments

litwol’s picture

Status: Needs review » Needs work

Can we instead port d7 drupal_static with pmsg namespace function name? does it fit the use case ?

berdir’s picture

Status: Needs work » Needs review

c/p from IRC:

Berdir: litwol: I don't think it makes sense to back-port that function, converting to drupal_static() should be rather easy, that's a change of a single code line if there is no special reset handling. even with 3-4 static variables, that still less code to change than adding and then removing that function

Also, if we need static reset, we would need to copy two functions.

naheemsays’s picture

Status: Needs review » Reviewed & tested by the community

Tested and this works as expected.

litwol’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.31 KB

Little code nitpick.

Please reivew.

berdir’s picture

comparison of the two approaches..

Note that I did remove the isset() check at the end, that is not necessary as you check at the beginning and always add something.

naheemsays’s picture

StatusFileSize
new3.75 KB

reroll of the static_nesting patch since I assume that is the approach that is preferred over the early return?

There is a slight change in code too - in the last there was

+      if (empty($thread['messages'])) {
+        $threads[$account->uid][$thread_id] = FALSE;
+      } else {
+        // general data, assume subject is the same for all messages of that thread.
+        $thread['user'] = $account;
+        $message = current($thread['messages']);
+        $thread['subject'] = $message['subject'];
+
+        $threads[$account->uid][$thread_id] = $thread;
+      }

I changed that to

+      if (empty($thread['messages'])) {
+        $thread = FALSE;
+      } else {
+        // general data, assume subject is the same for all messages of that thread.
+        $thread['user'] = $account;
+        $message = current($thread['messages']);
+        $thread['subject'] = $message['subject'];
+      }
+      $threads[$account->uid][$thread_id] = $thread;

This is not really a big patch - the majority of line changes are in indentation due to being inside another if statement - compare it to early return patch in the previous comment to see how small the functional changes really are.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Does work correctly and this was RTBC before, just hasn't been commited yet. This is quite an important performance improvement, so lets get this in.

litwol’s picture

Status: Reviewed & tested by the community » Fixed
litwol’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Fixed » Patch (to be ported)
berdir’s picture

Status: Patch (to be ported) » Reviewed & tested by the community
StatusFileSize
new2.94 KB

Straight re-roll for D7, no functional changes except incorparating the small change to privatemsg.module from #576366: D7 Port of pm_email_notify and pm_user_block

litwol’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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