steffen: server/kolab-resource-handlers/kolab-resource-handlers/freebusy freebusy.php, 1.32, 1.33 freebusycache.class.php, 1.5, 1.6 freebusycollector.class.php, 1.3, 1.4
cvs at intevation.de
cvs at intevation.de
Wed Oct 20 11:31:49 CEST 2004
- Previous message: martin: doc/architecture client_server.sgml, 1.14, 1.15 kde.sgml, 1.6, 1.7
- Next message: michel: doc/proko2-doc olcertificate.png, NONE, 1.1 doc3.sxw, 1.21, 1.22 olfreebusysetup.png, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy
In directory doto:/tmp/cvs-serv19456/kolab-resource-handlers/freebusy
Modified Files:
freebusy.php freebusycache.class.php
freebusycollector.class.php
Log Message:
weed out old pfbs
Index: freebusy.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusy.php,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- freebusy.php 13 Oct 2004 14:17:06 -0000 1.32
+++ freebusy.php 20 Oct 2004 09:31:47 -0000 1.33
@@ -80,7 +80,11 @@
}
}
$ts = max( $ts, $ts2 );
- if( $fb ) $collector->addFreebusy( $fb );
+ if( $fb ) {
+ if( $collector->addFreebusy( $fb ) == FB_TOO_OLD ) {
+ $cache->delete( $pfb );
+ }
+ }
}
$vfb = $collector->exportvCalendar();
Index: freebusycache.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusycache.class.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- freebusycache.class.php 16 Oct 2004 10:05:16 -0000 1.5
+++ freebusycache.class.php 20 Oct 2004 09:31:47 -0000 1.6
@@ -101,6 +101,23 @@
return false;
}
+ function delete( $filename ) {
+ $fbfilename = $this->mkfbfilename($filename);
+ if( $fbfilename != realpath( $fbfilename )) return false;
+ unlink($fbfilename);
+ unlink($this->mkaclfilename($filename));
+ $db = dba_open( $this->basedir.'/pfbcache.db', 'cd', 'gdbm' );
+ if( $db === false ) return false;
+ for( $uid = dba_firstkey($db); $uid !== false; $uid = dba_nextkey($db)) {
+ $lst = dba_fetch( $uid, $db );
+ $lst = $this->decodeList( $lst );
+ $lst = array_diff( $lst, array($filename));
+ myLog("(delete) dba_replace(".$uid.", \"".$this->encodeList($lst)."\")", RM_LOG_DEBUG);
+ dba_replace( $uid, $this->encodeList($lst), $db );
+ }
+ dba_close($db);
+ }
+
function findAll( $uid, $groups ) {
$lst = array();
$db = dba_open( $this->basedir.'/pfbcache.db', 'rd', 'gdbm' );
Index: freebusycollector.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusycollector.class.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- freebusycollector.class.php 20 Oct 2004 01:14:48 -0000 1.3
+++ freebusycollector.class.php 20 Oct 2004 09:31:47 -0000 1.4
@@ -1,6 +1,11 @@
<?php
+define( 'FB_OK', 0 );
+define( 'FB_TOO_OLD', 1 );
+define( 'FB_PARSE_ERROR', 2 );
+
class FreeBusyCollector {
+
function FreeBusyCollector( $organizer ) {
$this->organizer = $organizer;
$this->init();
@@ -33,13 +38,21 @@
$vCal = &new Horde_iCalendar();
if( !$vCal->parsevCalendar($text) ) {
trigger_error("Could not parse ical", E_USER_ERROR);
- return false;
+ return FB_PARSE_ERROR;
}
$vFb1 = &$this->vCal->findComponent( 'vfreebusy' );
$vFb2 = &$vCal->findComponent( 'vfreebusy' );
if( !$vFb2 ) {
trigger_error("Could not find freebusy info in ical", E_USER_ERROR);
- return false;
+ return FB_PARSE_ERROR;
+ }
+
+ if( $ets = $vFb2->getAttributeDefault( 'DTEND', false ) !== false ) {
+ // PENDING(steffen): Make value configurable
+ if( $ets < time() ) {
+ // Not relevant anymore
+ return FB_TOO_OLD;
+ }
}
if( ($sts = $vFb1->getAttributeDefault('DTSTART', false)) === false ) {
@@ -53,7 +66,8 @@
$vFb1->setAttribute('DTEND', max( $ets, $vFb2->getAttribute('DTEND')), array(), false );
}
- return $vFb1->merge( $vFb2 );
+ $vFb1->merge( $vFb2 );
+ return FB_OK;
}
function exportvCalendar() {
- Previous message: martin: doc/architecture client_server.sgml, 1.14, 1.15 kde.sgml, 1.6, 1.7
- Next message: michel: doc/proko2-doc olcertificate.png, NONE, 1.1 doc3.sxw, 1.21, 1.22 olfreebusysetup.png, 1.2, 1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list