From 2b7962805f9169a518b4bb602f30e4112ddf10e8 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Thu, 9 Feb 2023 13:50:09 +0100 Subject: [PATCH] PdoAddressBook `ORDER BY deleted DESC` to prevent sync and export issues --- .../RainLoop/Providers/AddressBook/PdoAddressBook.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php index e57dd5894..63cfbc289 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Providers/AddressBook/PdoAddressBook.php @@ -107,9 +107,12 @@ class PdoAddressBook private function prepareDatabaseSyncData() : array { $aResult = array(); - $oStmt = $this->prepareAndExecute('SELECT id_contact, id_contact_str, changed, deleted, etag FROM rainloop_ab_contacts WHERE id_user = :id_user', array( - ':id_user' => array($this->iUserID, \PDO::PARAM_INT) - )); + $oStmt = $this->prepareAndExecute('SELECT id_contact, id_contact_str, changed, deleted, etag + FROM rainloop_ab_contacts + WHERE id_user = :id_user + ORDER BY deleted DESC', + array(':id_user' => array($this->iUserID, \PDO::PARAM_INT)) + ); if ($oStmt) { $aFetch = $oStmt->fetchAll(\PDO::FETCH_ASSOC);