Update resource URI of cache entries when renaming a folder (#2269)
This commit is contained in:
parent
a2883e9402
commit
1a957820c4
2 changed files with 23 additions and 0 deletions
|
@ -276,6 +276,7 @@ class kolab_storage
|
||||||
{
|
{
|
||||||
self::setup();
|
self::setup();
|
||||||
|
|
||||||
|
$oldfolder = self::get_folder($oldname);
|
||||||
$active = self::folder_is_active($oldname);
|
$active = self::folder_is_active($oldname);
|
||||||
$success = self::$imap->rename_folder($oldname, $newname);
|
$success = self::$imap->rename_folder($oldname, $newname);
|
||||||
self::$last_error = self::$imap->get_error_str();
|
self::$last_error = self::$imap->get_error_str();
|
||||||
|
@ -286,6 +287,11 @@ class kolab_storage
|
||||||
self::set_state($newname, true);
|
self::set_state($newname, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// assign existing cache entries to new resource uri
|
||||||
|
if ($success && $oldfolder) {
|
||||||
|
$oldfolder->cache->rename($newname);
|
||||||
|
}
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -316,6 +316,23 @@ class kolab_storage_cache
|
||||||
return $this->db->affected_rows($result);
|
return $this->db->affected_rows($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update resource URI for existing cache entries
|
||||||
|
*
|
||||||
|
* @param string Target IMAP folder to move it to
|
||||||
|
*/
|
||||||
|
public function rename($new_folder)
|
||||||
|
{
|
||||||
|
$target = kolab_storage::get_folder($new_folder);
|
||||||
|
|
||||||
|
// resolve new message UID in target folder
|
||||||
|
$this->db->query(
|
||||||
|
"UPDATE kolab_cache SET resource=? ".
|
||||||
|
"WHERE resource=?",
|
||||||
|
$target->get_resource_uri(),
|
||||||
|
$this->resource_uri
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select Kolab objects filtered by the given query
|
* Select Kolab objects filtered by the given query
|
||||||
|
|
Loading…
Add table
Reference in a new issue