Standardize on *_Api::listUids() method name for api methods that, well, return Uids.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 26 Sep 2010 14:54:36 +0000 (10:54 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 26 Sep 2010 15:07:31 +0000 (11:07 -0400)
Kronolith_Api::listUids() functionality changed slightly with this commit - it now
no longer returns events that represent exceptions, and only includes recurring events
once within the requested time period. It looks like the syncml code was the only code
currently calling this method, so there should be no issues with this change.

For the other apps, this only represents a method name change.

Bug: 9253

framework/SyncML/SyncML/Backend/Horde.php
kronolith/lib/Api.php
mnemo/lib/Api.php
nag/lib/Api.php
turba/lib/Api.php

index 5c25607..769a38b 100644 (file)
@@ -109,11 +109,6 @@ class SyncML_Backend_Horde extends SyncML_Backend {
     {
         global $registry;
 
-        $apimap = array('calendar' => 'listEvents',
-                        'contacts' => 'listContacts',
-                        'tasks' => 'listTasks',
-                        'notes' => 'listNotes');
-
         $adds = $mods = $dels = array();
         $database = $this->_normalize($databaseURI);
         $slowsync = $from_ts == 0;
@@ -135,10 +130,10 @@ class SyncML_Backend_Horde extends SyncML_Backend {
                     }
                     $start = new Horde_Date($start);
                     $this->logMessage('Slow-syncing all events starting from ' . (string)$start, 'DEBUG');
-                    $data = $registry->{$database}->{$apimap[$database]}(
+                    $data = $registry->{$database}->listUids(
                                 SyncML_Backend::getParameter($databaseURI, 'source'), $start);
                 } else {
-                    $data = $registry->{$database}->{$apimap[$database]}(
+                    $data = $registry->{$database}->listUids(
                                 SyncML_Backend::getParameter($databaseURI, 'source'));
                 }
             } else {
index 8409f02..e653d4a 100644 (file)
@@ -437,6 +437,9 @@ class Kronolith_Api extends Horde_Registry_Api
 
     /**
      * Returns the ids of all the events that happen within a time period.
+     * Only includes recurring events once per time period, and does not include
+     * events that represent exceptions, making this method useful for syncing
+     * purposes. For more control, use the listEvents method.
      *
      * @param string $calendar      The calendar to check for events.
      * @param object $startstamp    The start of the time range.
@@ -456,7 +459,14 @@ class Kronolith_Api extends Horde_Registry_Api
         }
 
         $events = Kronolith::getDriver(null, $calendar)
-            ->listEvents(new Horde_Date($startstamp), new Horde_Date($endstamp));
+            ->listEvents(new Horde_Date($startstamp),
+                         new Horde_Date($endstamp),
+                         false,  // recurrence
+                         false,  // alarm
+                         false,  // no json cache
+                         false,  // Don't cover dates
+                         true,   // Hide exceptions
+                         false); // No tags
         $uids = array();
         foreach ($events as $dayevents) {
             foreach ($dayevents as $event) {
index f327a60..2fd70ea 100644 (file)
@@ -92,7 +92,7 @@ class Mnemo_Api extends Horde_Registry_Api
      *
      * @return array  An array of UIDs for all notes the user can access.
      */
-    public function listNotes($notepad = null)
+    public function listUids($notepad = null)
     {
         global $conf;
 
index 9b35408..30409e7 100644 (file)
@@ -643,7 +643,7 @@ class Nag_Api extends Horde_Registry_Api
      * @return array             An array of UIDs for all tasks
      *                           the user can access.
      */
-    public function listTaskUids($tasklist = null)
+    public function listUids($tasklist = null)
     {
         if (!isset($GLOBALS['conf']['storage']['driver'])) {
             return PEAR::raiseError(_("Not configured"));
index 9a54ab9..94321ee 100644 (file)
@@ -434,7 +434,7 @@ class Turba_Api extends Horde_Registry_Api
      * @return array  An array of UIDs for all contacts the user can access.
      * @throws Turba_Exception
      */
-    public function listContacts($sources = null)
+    public function listUids($sources = null)
     {
         global $cfgSources, $prefs;