Performance: Make objects moving faster (less SQL and less IMAP operations) using COPYUID

This commit is contained in:
Aleksander Machniak 2016-02-24 13:57:58 +01:00
parent 9ac901b90a
commit 6c25221b95
2 changed files with 13 additions and 7 deletions

View file

@ -429,18 +429,23 @@ class kolab_storage_cache
/**
* Move an existing cache entry to a new resource
*
* @param string Entry's IMAP message UID
* @param string Entry's Object UID
* @param object kolab_storage_folder Target storage folder instance
* @param string Entry's IMAP message UID
* @param string Entry's Object UID
* @param kolab_storage_folder Target storage folder instance
* @param string Target entry's IMAP message UID
*/
public function move($msguid, $uid, $target)
public function move($msguid, $uid, $target, $new_msguid = null)
{
if ($this->ready) {
if ($this->ready && $target) {
// clear cached uid mapping and force new lookup
unset($target->cache->uid2msg[$uid]);
// resolve new message UID in target folder
if ($new_msguid = $target->cache->uid2msguid($uid)) {
if (!$new_msguid) {
$new_msguid = $target->cache->uid2msguid($uid);
}
if ($new_msguid) {
$this->_read_folder_data();
$this->db->query(

View file

@ -930,7 +930,8 @@ class kolab_storage_folder extends kolab_storage_folder_api
$this->cache->bypass(false);
if ($result) {
$this->cache->move($msguid, $uid, $target_folder);
$new_uid = ($copyuid = $this->imap->conn->data['COPYUID']) ? $copyuid[1] : null;
$this->cache->move($msguid, $uid, $target_folder, $new_uid);
return true;
}
else {