From d54eb6c95104316180bbaa777f2d95f8d88c0f3c Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 10 Apr 2016 04:51:07 -0400
Subject: [PATCH] CS fixes

---
 CHANGELOG                                     |    1 +
 program/lib/Roundcube/rcube_result_thread.php |    5 +++--
 program/lib/Roundcube/rcube_result_index.php  |    1 -
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index efffb6c..fadaf46 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,7 @@
 - newmail_notifier: Refactor desktop notifications
 - Fix so contactlist_fields option can be set via config file
 - Fix so SPECIAL-USE assignments are forced only until user sets special folders (#4782)
+- Fix performance in reverting order of THREAD result
 
 RELEASE 1.1.4
 -------------
diff --git a/program/lib/Roundcube/rcube_result_index.php b/program/lib/Roundcube/rcube_result_index.php
index ffc1ad7..41509ae 100644
--- a/program/lib/Roundcube/rcube_result_index.php
+++ b/program/lib/Roundcube/rcube_result_index.php
@@ -259,7 +259,6 @@
             return;
         }
 
-        // @TODO: maybe do this in chunks
         $data = $this->get();
         $data = array_reverse($data);
         $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data);
diff --git a/program/lib/Roundcube/rcube_result_thread.php b/program/lib/Roundcube/rcube_result_thread.php
index 7123f47..995d794 100644
--- a/program/lib/Roundcube/rcube_result_thread.php
+++ b/program/lib/Roundcube/rcube_result_thread.php
@@ -252,8 +252,9 @@
             return;
         }
 
-        $raw_data_reverse = implode(self::SEPARATOR_ELEMENT, array_reverse(explode(self::SEPARATOR_ELEMENT, $this->raw_data)));
-        $this->raw_data = $raw_data_reverse;
+        $data = explode(self::SEPARATOR_ELEMENT, $this->raw_data);
+        $data = array_reverse($data);
+        $this->raw_data = implode(self::SEPARATOR_ELEMENT, $data);
 
         $this->meta['pos'] = array();
     }

--
Gitblit v1.9.1