Implement delete_all()
This commit is contained in:
parent
2a208c02ce
commit
3c44d7f768
2 changed files with 19 additions and 5 deletions
|
@ -227,8 +227,10 @@ class kolab_storage_dav_cache extends kolab_storage_cache
|
||||||
/**
|
/**
|
||||||
* Return current folder index (uid -> etag)
|
* Return current folder index (uid -> etag)
|
||||||
*/
|
*/
|
||||||
protected function folder_index()
|
public function folder_index()
|
||||||
{
|
{
|
||||||
|
$this->_read_folder_data();
|
||||||
|
|
||||||
// read cache index
|
// read cache index
|
||||||
$sql_result = $this->db->query(
|
$sql_result = $this->db->query(
|
||||||
"SELECT `uid`, `etag` FROM `{$this->cache_table}` WHERE `folder_id` = ?",
|
"SELECT `uid`, `etag` FROM `{$this->cache_table}` WHERE `folder_id` = ?",
|
||||||
|
|
|
@ -257,7 +257,7 @@ class kolab_storage_dav_folder extends kolab_storage_folder
|
||||||
|
|
||||||
$uid = is_array($object) ? $object['uid'] : $object;
|
$uid = is_array($object) ? $object['uid'] : $object;
|
||||||
|
|
||||||
$success = $this->dav->delete($this->object_location($uid), $content);
|
$success = $this->dav->delete($this->object_location($uid));
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$this->cache->set($uid, false);
|
$this->cache->set($uid, false);
|
||||||
|
@ -267,7 +267,11 @@ class kolab_storage_dav_folder extends kolab_storage_folder
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Delete all objects in a folder.
|
||||||
*
|
*
|
||||||
|
* Note: This method is used by kolab_addressbook plugin only
|
||||||
|
*
|
||||||
|
* @return bool True if successful, false on error
|
||||||
*/
|
*/
|
||||||
public function delete_all()
|
public function delete_all()
|
||||||
{
|
{
|
||||||
|
@ -275,10 +279,18 @@ class kolab_storage_dav_folder extends kolab_storage_folder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This method is used by kolab_addressbook plugin only
|
// TODO: Maybe just deleting and re-creating a folder would be
|
||||||
// $this->cache->purge();
|
// better, but probably might not always work (ACL)
|
||||||
|
|
||||||
return false;
|
$this->cache->synchronize();
|
||||||
|
|
||||||
|
foreach (array_keys($this->cache->folder_index()) as $uid) {
|
||||||
|
$this->dav->delete($this->object_location($uid));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->cache->purge();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue