From 95d623ef3b92818099d9621d625546aa47257530 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 8 Sep 2009 23:59:44 +0200 Subject: [PATCH] Use Horde_Support_Guid. --- kronolith/lib/Driver.php | 15 --------------- kronolith/lib/Driver/Sql.php | 4 ++-- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/kronolith/lib/Driver.php b/kronolith/lib/Driver.php index 823f4b17b..e0e5f306c 100644 --- a/kronolith/lib/Driver.php +++ b/kronolith/lib/Driver.php @@ -92,21 +92,6 @@ class Kronolith_Driver } /** - * Generates a universal / unique identifier for a task. - * - * This is NOT something that we expect to be able to parse into a - * calendar and an event id. - * - * @return string A nice unique string (should be 255 chars or less). - */ - public function generateUID() - { - return date('YmdHis') . '.' - . substr(str_pad(base_convert(microtime(), 10, 36), 16, uniqid(mt_rand()), STR_PAD_LEFT), -16) - . '@' . $GLOBALS['conf']['server']['name']; - } - - /** * Renames a calendar. * * @param string $from The current name of the calendar. diff --git a/kronolith/lib/Driver/Sql.php b/kronolith/lib/Driver/Sql.php index fb0c1d7ee..1fc3328d5 100644 --- a/kronolith/lib/Driver/Sql.php +++ b/kronolith/lib/Driver/Sql.php @@ -361,7 +361,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver /* If the event did not have a UID before, we need to give * it one. */ if (empty($row['event_uid'])) { - $row['event_uid'] = $this->generateUID(); + $row['event_uid'] = (string)new Horde_Support_Guid; /* Save the new UID for data integrity. */ $query = 'UPDATE ' . $this->_params['table'] . ' SET event_uid = ? WHERE event_id = ?'; @@ -597,7 +597,7 @@ class Kronolith_Driver_Sql extends Kronolith_Driver if ($event->getUID()) { $uid = $event->getUID(); } else { - $uid = $this->generateUID(); + $uid = (string)new Horde_Support_Guid; $event->setUID($uid); } -- 2.11.0