steffen: server/kolab-resource-handlers/kolab-resource-handlers/freebusy freebusy.class.php, 1.7, 1.8 freebusycache.class.php, 1.6, 1.7

cvs at intevation.de cvs at intevation.de
Wed Oct 20 14:31:35 CEST 2004


Author: steffen

Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy
In directory doto:/tmp/cvs-serv21681/kolab-resource-handlers/freebusy

Modified Files:
	freebusy.class.php freebusycache.class.php 
Log Message:
fix for issue461 (pfbs not properly removed from pfbcache.db)

Index: freebusy.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusy.class.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- freebusy.class.php	20 Oct 2004 01:14:48 -0000	1.7
+++ freebusy.class.php	20 Oct 2004 12:31:33 -0000	1.8
@@ -142,35 +142,25 @@
 	case 'daily':
 	  // Daily recurrence, every 'interval' days
 	  $count = 0;
-	  for( $t = $initial_start; $t < $endstamp; $t += 24*60*60*(int)$rec['interval'] ) {
+	  for( $t = $initial_start; $t < $endstamp; $t = strtotime( '+'.$rec['interval'].' days',$t) ) {
 	    myLog("Adding recurrence $t -> ".($t+$duration), RM_LOG_DEBUG );
 	    $vFb->addBusyPeriod('BUSY', $t, null, $duration, $extra);	    
 	    $count++;
 	    if( $rangetype == 'number' && $count > $range ) {
 	      break;
-	    } else if( $rangetype == 'date' && $t > $range+24*60*60) {
+	    } else if( $rangetype == 'date' && $t > strtotime( '+1 day',$range ) ) {
 	      break;
 	    }
 	  }
 	  break;
 	case 'weekly':
 	  // Weekly recurrence, every 'interval' weeks on 'day' days
-	  $wstart = $this->weekStart( $initial_start );
 	  $interval = (int)$rec['interval'];
 	  if( !$interval ) $interval = 1;
 	  $count = 0;
-	  for( $t = $wstart; $t < $endstamp; $t += 7*24*60*60*$interval ) {
-	    if( $this->week_starts_on_sunday ) {
-	      $days = array( 'monday' => 1, 'tuesday' => 2, 'wednesday' => 3,
-			     'thursday' => 4, 'friday' => 5, 'saturday' => 6,
-			     'sunday' => 0 );
-	    } else {
-	      $days = array( 'monday' => 0, 'tuesday' => 1, 'wednesday' => 2,
-			     'thursday' => 3, 'friday' => 4, 'saturday' => 5,
-			     'sunday' => 6 );
-	    }
+	  for( $t = $initial_start; $t < $endstamp; $t = strtotime( "+$interval weeks", $t) ) {
 	    foreach( $rec['day'] as $day ) {
-	      $tmp = $t+24*60*60*$days[$day] + $this->getTimePart( $t );
+	      $tmp = strtotime( $day, $t);// + $this->getTimePart( $t );
 	      if( $tmp < $endstamp ) {
 		myLog("Adding recurrence $tmp -> ".($tmp+$duration), RM_LOG_DEBUG );
 		$vFb->addBusyPeriod('BUSY', $tmp, null, $duration, $extra);	      
@@ -181,7 +171,7 @@
 	    $count++;
 	    if( $rangetype == 'number' && $count > $range ) {
 	      break;
-	    } else if( $rangetype == 'date' && $t > $range+24*60*60) {
+	    } else if( $rangetype == 'date' && $t > strtotime( '+1 day',$range ) ) {
 	      break;
 	    }	    
 	  }
@@ -283,21 +273,6 @@
                      $date['month'], $date['mday'], $date['year']);
   }
 
-  /* Returns 00:00 on the first day of the current week 
-   * in local time */
-  function weekStart( $ts ) {
-    $a = getdate($ts);
-    if( $this->week_starts_on_sunday ) {
-      $d = $a['wday'];
-    } else {
-      $d = $a['wday']-1;
-      if( $d < 0 ) $d = 6;
-    }
-    $ts = $ts - 24*60*60*$d;
-    $a = getdate($ts);
-    return mktime( 0,0,0,$a['mon'], $a['mday'], $a['year']);
-  }
-
   /* Return the time of day of a timestamp as seconds since midnight */
   function getTimePart( $ts ) {
     $a = getdate($ts);
@@ -322,7 +297,7 @@
     
     // Build the event hash
     foreach ($childnodes as $value) {
-      myLog("Looking at tag ".($value->tagname), RM_LOG_DEBUG);
+      //myLog("Looking at tag ".($value->tagname), RM_LOG_DEBUG);
       if( $value->tagname == 'recurrence' ) {
 	$rhash = array();
 	$attrs = $value->attributes();
@@ -345,7 +320,7 @@
       }
     }
     
-    myLog("RAW Event: ".print_r($event_hash, true), RM_LOG_DEBUG);
+    //myLog("RAW Event: ".print_r($event_hash, true), RM_LOG_DEBUG);
 
     // Perform some sanity checks on the event
     if (

Index: freebusycache.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/freebusy/freebusycache.class.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- freebusycache.class.php	20 Oct 2004 09:31:47 -0000	1.6
+++ freebusycache.class.php	20 Oct 2004 12:31:33 -0000	1.7
@@ -32,7 +32,7 @@
       }
       unlink($fbfilename.'.acl');
     } else {
-      myLog("Storing $filename with acl ".var_export($acl,true), RM_LOG_DEBUG);
+      //myLog("Storing $filename with acl ".var_export($acl,true), RM_LOG_DEBUG);
       
       // Create directories if missing
       $fbdirname  = dirname( $fbfilename );
@@ -67,10 +67,8 @@
 	    $lst = dba_fetch( $ac['USER'], $db );
 	    $lst = $this->decodeList( $lst );
 	    $lst[] = $filename;
-	    myLog("(add) dba_replace(".$ac['USER'].", \"".$this->encodeList(array_unique($lst))."\")", RM_LOG_DEBUG);
 	    dba_replace( $ac['USER'], $this->encodeList(array_unique($lst)), $db );
 	  } else {
-	    myLog("(add) dba_insert(".$ac['USER'].", \"".$filename."\")", RM_LOG_DEBUG);
 	    dba_insert( $ac['USER'], $filename, $db );
 	  }
 	}
@@ -80,8 +78,7 @@
 	if( dba_exists( $uid, $db ) ) {
 	  $lst = dba_fetch( $uid, $db );
 	  $lst = $this->decodeList( $lst );
-	  $lst = array_diff( $lst, array($fbfilename));
-	  myLog("(delete) dba_replace(".$uid.", \"".$this->encodeList($lst)."\")", RM_LOG_DEBUG);
+	  $lst = array_diff( $lst, array($filename));
 	  dba_replace( $uid, $this->encodeList($lst), $db );
 	}     
       }





More information about the commits mailing list