Author: ralfbecker
New Revision: 33288
URL: http://www.egroupware.org/viewvc/egroupware?rev=33288&view=rev
Log:
moved ctag to calendar_bo, to use it in CalDAV and ActiveSync, thought it needs to be reworked, as it is to expensive performance-wise
Modified:
trunk/calendar/inc/class.calendar_activesync.inc.php
trunk/calendar/inc/class.calendar_bo.inc.php
trunk/calendar/inc/class.calendar_groupdav.inc.php
Modified: trunk/calendar/inc/class.calendar_activesync.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_activesync.inc.php?rev=33288&r1=33287&r2=33288&view=diff
— trunk/calendar/inc/class.calendar_activesync.inc.php (original)
+++ trunk/calendar/inc/class.calendar_activesync.inc.php Thu Dec 2 23:27:32 2010
@@ -308,10 +308,32 @@
}
/**
-
- @todo implement using ctag
-
- Return a changes array
-
-
* if changes occurr default diff engine computes the actual changes -
-
- @param string $folderid
-
- @param string &$syncstate on call old syncstate, on return new syncstate
-
-
@return array|boolean false if $folderid not found, array() if no changes or array(array(“type” => “fakeChange”))
*/
function AlterPingChanges($folderid, &$syncstate)
{
-
@return array|boolean false if $folderid not found, array() if no changes or array(array(“type” => “fakeChange”))
-
return false;
-
$this->backend->splitID($folderid, $type, $owner); -
if ($type != 'calendar') return false; -
if (!isset($this->calendar)) $this->calendar = new calendar_boupdate(); -
$ctag = $this->calendar->get_ctag($owner); -
$changes = array(); // no change -
$syncstate_was = $syncstate; -
if ($ctag !== $syncstate) -
{ -
$syncstate = $ctag; -
$changes = array(array('type' => 'fakeChange')); -
} -
//error_log(__METHOD__."('$folderid','$syncstate_was') syncstate='$syncstate' returning ".array2string($changes)); -
}return $changes;
}
Modified: trunk/calendar/inc/class.calendar_bo.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_bo.inc.php?rev=33288&r1=33287&r2=33288&view=diff
— trunk/calendar/inc/class.calendar_bo.inc.php (original)
+++ trunk/calendar/inc/class.calendar_bo.inc.php Thu Dec 2 23:27:32 2010
@@ -1908,4 +1908,40 @@
//error_log(METHOD . “($entry[id] ($entry[etag]): $entry[title] --> etag=$etag”);
return $etag;
}
+
- /**
-
- Query ctag for calendar
-
-
- @param $user
-
- @param $filter=‘owner’
-
- @return string
-
- @todo use MAX(modified) to query everything in one sql query, currently we do one query per event (more then the search)
- */
- public function get_ctag($user,$filter=‘owner’)
- {
-
$filter = array( -
'users' => $user, -
'start' => $this->bo->now - 100*24*3600, // default one month back -30 breaks all sync recurrences -
'end' => $this->bo->now + 365*24*3600, // default one year into the future +365 -
'enum_recuring' => false, -
'daywise' => false, -
'date_format' => 'server', -
'cols' => array('egw_cal.cal_id', 'cal_start', 'cal_modified'), -
'filter' => $filter, -
); -
$ctag = 0; -
if (($events =& $this->bo->search($filter))) -
{ -
foreach ($events as $event) -
{ -
$modified = max($this->bo->so->max_user_modified($event['cal_id']), $event['cal_modified']); -
if ($ctag < $modified) $ctag = $modified; -
} -
} -
if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user] = $ctag"); -
return $ctag; - }
}
Modified: trunk/calendar/inc/class.calendar_groupdav.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_groupdav.inc.php?rev=33288&r1=33287&r2=33288&view=diff
— trunk/calendar/inc/class.calendar_groupdav.inc.php (original)
+++ trunk/calendar/inc/class.calendar_groupdav.inc.php Thu Dec 2 23:27:32 2010
@@ -790,35 +790,7 @@
*/
public function getctag($path,$user)
{
-
$filter = array( -
'users' => $user, -
'start' => $this->bo->now - 100*24*3600, // default one month back -30 breaks all sync recurrences -
'end' => $this->bo->now + 365*24*3600, // default one year into the future +365 -
'enum_recuring' => false, -
'daywise' => false, -
'date_format' => 'server', -
'cols' => array('egw_cal.cal_id', 'cal_start', 'cal_modified'), -
); -
if ($path == '/calendar/') -
{ -
$filter['filter'] = 'owner'; -
} -
else -
{ -
$filter['filter'] = 'default'; // not rejected -
} -
$ctag = 0; -
if (($events =& $this->bo->search($filter))) -
{ -
foreach ($events as $event) -
{ -
$modified = max($this->bo->so->max_user_modified($event['cal_id']), $event['cal_modified']); -
if ($ctag < $modified) $ctag = $modified; -
} -
}
-
$ctag = $this->bo->get_ctag($user,$path == '/calendar/' ? 'owner' : 'default'); // default = not rejected if ($this->debug > 1) error_log(__FILE__.'['.__LINE__.'] '.__METHOD__. "($path)[$user] = $ctag");
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel® Graphics Technology. Get started today with the
Intel® Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs