[dev] another trean patch

Ben Chavet ben at chavet.net
Wed Dec 8 19:42:58 PST 2004


If the "name" field was too long, the database would complain.  Also if 2 
bookmarks happened to have the same name, there would be a collision. 
This patch uses an md5sum as the "name" field stored in the datatree

--Ben
-------------- next part --------------
Index: Bookmarks.php
===================================================================
RCS file: /repository/trean/lib/Bookmarks.php,v
retrieving revision 1.31
diff -u -r1.31 Bookmarks.php
--- Bookmarks.php	7 Dec 2004 16:09:17 -0000	1.31
+++ Bookmarks.php	9 Dec 2004 03:41:31 -0000
@@ -314,9 +314,7 @@
      */
     function addBookmark(&$bookmark)
     {
-        $name = $bookmark->getName();
-
-        $this->data['bookmarks'][$name] = $bookmark;
+        $this->data['bookmarks'][md5(microtime())] = $bookmark;
         if ($this->_bookmarksOb->_bookmarks->exists($this->getName())) {
             return $this->_bookmarksOb->updateCategory($this);
         }


More information about the dev mailing list