extend ctag to lists

This commit is contained in:
Ralf Becker 2012-01-31 20:06:27 +00:00
parent 5c020ac87d
commit 6f1c2eacac
3 changed files with 32 additions and 1 deletions

View File

@ -623,7 +623,7 @@ class addressbook_groupdav extends groupdav_handler
// not showing addressbook of a single user?
if (!$user || $path == '/addressbook/') $user = null;
return $this->bo->get_ctag($user);
return max($this->bo->get_ctag($user),$this->bo->lists_ctag($user));
}
/**

View File

@ -1057,4 +1057,17 @@ class addressbook_so
return method_exists($backend,'read_list');
}
/**
* Get ctag (max list_modified as timestamp) for lists
*
* @param int|array $owner=null null for all lists user has access too
* @return int
*/
function lists_ctag($owner=null)
{
if (!method_exists($this->somain,'read_list')) return 0;
return $this->somain->lists_ctag($owner);
}
}

View File

@ -646,6 +646,24 @@ class addressbook_sql extends so_sql_cf
return $this->db->affected_rows();
}
/**
* Get ctag (max list_modified as timestamp) for lists
*
* @param int|array $owner=null null for all lists user has access too
* @return int
*/
function lists_ctag($owner=null)
{
if (is_null($owner)) $owner = array_keys($this->grants);
if (!($modified = $this->db->select($this->lists_table,'MAX(list_modified)',array('list_owner'=>$owner),
__LINE__,__FILE__)->fetchColumn()))
{
return 0;
}
return $this->db->from_timestamp($modified);
}
/**
* Reads a contact, reimplemented to use the uid, if a non-numeric key is given
*