Small improvements in DAV handler
This commit is contained in:
parent
980c5733dd
commit
737f4c119e
3 changed files with 14 additions and 4 deletions
|
@ -541,7 +541,7 @@ class kolab_storage_cache
|
||||||
*
|
*
|
||||||
* @param string $uid Object UID
|
* @param string $uid Object UID
|
||||||
*
|
*
|
||||||
* @return array The Kolab object represented as hash array
|
* @return array|null The Kolab object represented as hash array
|
||||||
*/
|
*/
|
||||||
public function get_by_uid($uid)
|
public function get_by_uid($uid)
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,8 +204,7 @@ class kolab_storage_dav_folder extends kolab_storage_folder
|
||||||
*/
|
*/
|
||||||
public function get_uid()
|
public function get_uid()
|
||||||
{
|
{
|
||||||
// TODO ???
|
return $this->id;
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -380,6 +379,17 @@ class kolab_storage_dav_folder extends kolab_storage_folder
|
||||||
$object['changed'] = new DateTime('now');
|
$object['changed'] = new DateTime('now');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure UID exists
|
||||||
|
if (empty($object['uid'])) {
|
||||||
|
if ($uid) {
|
||||||
|
$object['uid'] = $uid;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$username = rcube::get_instance()->user->get_username();
|
||||||
|
$object['uid'] = strtoupper(md5(time() . uniqid(rand())) . '-' . substr(md5($username), 0, 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// generate and save object message
|
// generate and save object message
|
||||||
if ($content = $this->to_dav($object)) {
|
if ($content = $this->to_dav($object)) {
|
||||||
$method = $uid ? 'update' : 'create';
|
$method = $uid ? 'update' : 'create';
|
||||||
|
|
|
@ -270,7 +270,7 @@ class kolab_storage_folder extends kolab_storage_folder_api
|
||||||
*
|
*
|
||||||
* @param string $uid Object UID
|
* @param string $uid Object UID
|
||||||
*
|
*
|
||||||
* @return array The Kolab object represented as hash array
|
* @return array|false|null The Kolab object represented as hash array, False on error
|
||||||
*/
|
*/
|
||||||
public function get_object($uid)
|
public function get_object($uid)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue