mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 15:48:55 +01:00
Fix CTag issues for GroupDAV
This commit is contained in:
parent
13ef80b7a5
commit
716b9e2b5d
@ -393,8 +393,16 @@ class addressbook_groupdav extends groupdav_handler
|
||||
|
||||
$result = $this->bo->search(array(),'MAX(contact_modified) AS contact_modified','','','',false,'AND',false,$filter);
|
||||
|
||||
$ctag = 'EGw-'.$result[0]['contact_modified'].'-wGE';
|
||||
return $ctag;
|
||||
if (empty($result))
|
||||
{
|
||||
$ctag = $result[0]['contact_modified'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$ctag = time();
|
||||
}
|
||||
|
||||
return 'EGw-'.$ctag.'-wGE';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -758,34 +758,11 @@ error_log(__METHOD__."($path,,".array2string($start).") filter=".array2string($f
|
||||
*/
|
||||
public function getctag($path,$user)
|
||||
{
|
||||
if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user]");
|
||||
$ctag = $GLOBALS['egw']->contenthistory->getLastChange('calendar');
|
||||
|
||||
$filter = array(
|
||||
'users' => $user,
|
||||
'start' => time()-100*24*3600, // default one month back -30 breaks all sync recurrences
|
||||
'end' => time()+365*24*3600, // default one year into the future +365
|
||||
'enum_recuring' => false,
|
||||
'daywise' => false,
|
||||
'date_format' => 'server',
|
||||
'order' => 'cal_modified DESC,cal_etag DESC',
|
||||
'offset' => 0,
|
||||
'num_rows' => 1,
|
||||
);
|
||||
if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user] = $ctag");
|
||||
|
||||
if (strpos($path, '/calendar') === 0)
|
||||
{
|
||||
$filter['filter'] = 'owner';
|
||||
}
|
||||
else
|
||||
{
|
||||
$filter['filter'] = 'default'; // not rejected
|
||||
}
|
||||
|
||||
$result =& $this->bo->search($filter);
|
||||
|
||||
$entry = array_shift($result);
|
||||
|
||||
return $this->get_etag($entry);
|
||||
return 'EGw-'.$ctag.'-wGE';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,4 +170,32 @@ class contenthistory
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the timestamp of last change for appname
|
||||
*
|
||||
* find which content changed since $_ts for application $_appName
|
||||
*
|
||||
* @param string$_appName the appname example: infolog_notes
|
||||
*
|
||||
* @return timestamp of last change for this application
|
||||
*/
|
||||
function getLastChange($_appName)
|
||||
{
|
||||
$max = 0;
|
||||
|
||||
$where = array('sync_appname' => $_appName);
|
||||
|
||||
foreach (array('modified','deleted','added') as $action)
|
||||
{
|
||||
if (($ts = $this->db->select(self::TABLE,'MAX(sync_'.$action.')',$where,__LINE__,__FILE__)->fetchColumn()))
|
||||
{
|
||||
$ts = $this->db->from_timestamp($ts);
|
||||
if ($ts > $max) $max = $ts;
|
||||
}
|
||||
}
|
||||
|
||||
return $max;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user