Clean up uid/randomid/guid changes.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 3 Aug 2010 15:58:03 +0000 (11:58 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 3 Aug 2010 15:58:03 +0000 (11:58 -0400)
Use Horde_Support_Randomid:: for local object ids when we need a smaller value,
Use Horde_Support_Guid:: for object uids (not Horde_Support_Uuid:: since these need
to be globally unique).
Use Horde_Support_Uuid for share ids and other cases where we can use a larger value.

I still question the need for even the Randomid in places like internal object ids, when
integer autoincrement fields would suffice.

kronolith/lib/Driver/Sql.php
nag/lib/Driver.php
nag/lib/Driver/Kolab.php
nag/lib/Driver/Sql.php
turba/lib/Driver.php
turba/lib/Driver/Sql.php
turba/scripts/upgrades/public_to_horde_share.php
turba/search.php

index ead9b6a..c1c9ce6 100644 (file)
@@ -607,7 +607,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver
         if ($event->id) {
             $id = $event->id;
         } else {
-            $id = strval(new Horde_Support_Uuid);
+            $id = strval(new Horde_Support_Randomid);
             $event->id = $id;
         }
 
index 5e77311..13f87a5 100644 (file)
@@ -197,7 +197,7 @@ class Nag_Driver
                  $owner = null, $assignee = null)
     {
         if (is_null($uid)) {
-            $uid = strval(new Horde_Support_Uuid());
+            $uid = strval(new Horde_Support_Guid());
         }
         if (is_null($owner)) {
             $owner = $GLOBALS['registry']->getAuth();
index 035419b..6c8202e 100644 (file)
@@ -436,7 +436,7 @@ class Nag_Driver_kolab_wrapper_old extends Nag_Driver_kolab_wrapper {
     {
         // Usually provided by the generic Driver class
         if ($uid !== null) {
-            $uid = strval(new Horde_Support_Uuid());
+            $uid = strval(new Horde_Support_Guid());
         }
 
         // Load the object into the kolab driver
@@ -785,7 +785,7 @@ class Nag_Driver_kolab_wrapper_new extends Nag_Driver_kolab_wrapper {
                         $completed_date = null)
     {
         if (empty($uid)) {
-            $task_uid = strval(new Horde_Support_Uuid());
+            $task_uid = strval(new Horde_Support_Guid());
             $old_uid = null;
         } else {
             list($task_uid, $tasklist) = $this->_splitId($uid);
index b0f1185..5fa9e77 100644 (file)
@@ -162,9 +162,9 @@ class Nag_Driver_Sql extends Nag_Driver {
                   $methods = null, $uid = null, $parent = '', $private = false,
                   $owner = null, $assignee = null)
     {
-        $taskId = strval(new Horde_Support_Uuid());
+        $taskId = strval(new Horde_Support_Randomid());
         if ($uid === null) {
-            $uid = strval(new Horde_Support_Uuid());
+            $uid = strval(new Horde_Support_Guid());
         }
 
         $query = sprintf(
@@ -528,7 +528,7 @@ class Nag_Driver_Sql extends Nag_Driver {
     {
         /* Make sure tasks always have a UID. */
         if (empty($row['task_uid'])) {
-            $row['task_uid'] = strval(new Horde_Support_Uuid());
+            $row['task_uid'] = strval(new Horde_Support_Guid());
 
             $query = 'UPDATE ' . $this->_params['table'] .
                 ' SET task_uid = ?' .
index ce912ca..b6c1981 100644 (file)
@@ -789,7 +789,7 @@ class Turba_Driver
         }
 
         if (!isset($attributes['__uid'])) {
-            $attributes['__uid'] = strval(new Horde_Support_Uuid());
+            $attributes['__uid'] = strval(new Horde_Support_Randomid());
         }
 
         $key = $attributes['__key'] = $this->_makeKey($this->toDriverKeys($attributes));
index b23bdfc..113ec13 100644 (file)
@@ -587,7 +587,7 @@ class Turba_Driver_Sql extends Turba_Driver
      */
     function _makeKey($attributes)
     {
-        return strval(new Horde_Support_Uuid());
+        return strval(new Horde_Support_Randomid());
     }
 
     /**
index 917ed1e..7771b3f 100755 (executable)
@@ -58,7 +58,7 @@ if (!$sourceKey) {
 }
 
 // Create the new share.
-$owner_uid = strval(new Horde_Support_Uuid());
+$owner_uid = strval(new Horde_Support_Randomid());
 $share = &$turba_shares->newShare($sourceKey . ':' . $owner_uid);
 if ($share instanceof Horde_Share_Exception) {
     var_dump($share);
index 9b5384b..cf1b60d 100644 (file)
@@ -27,7 +27,7 @@ function _createVBook($params)
                                     'criteria' => $params['criteria'])));
 
     try {
-        $share = Turba::createShare(strval(new Horde_Support_Uuid()), $params);
+        $share = Turba::createShare(strval(new Horde_Support_RandomId()), $params);
     } catch (Horde_Share_Exception $e) {
         throw new Turba_Exception($e);
     }