]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Adding crc32 to uniqueify conversation URIs
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 27 Nov 2014 16:05:01 +0000 (17:05 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 27 Nov 2014 16:05:01 +0000 (17:05 +0100)
This really should be a UUID or something else totally unexpected
but I figure that crc32 is good enough for now. The reason we keep
the main structure is because some third party scripts have begun
relying upon the tag URI format to parse out domain name, type etc.

classes/Conversation.php

index 67ac89cf1c267efa4dab53912e1cc33746ecf582..56f61c63ab2c1453ebd8250c6c17b721bd358bcc 100644 (file)
@@ -71,10 +71,11 @@ class Conversation extends Managed_DataObject
         $conv = new Conversation();
         $conv->created = common_sql_now();
         $conv->id = $notice->id;
-        $conv->uri = $uri ?: sprintf('%s%s=%d:%s=%s',
+        $conv->uri = $uri ?: sprintf('%s%s=%d:%s=%s:%s=%x',
                              TagURI::mint(),
                              'noticeId', $notice->id,
-                             'objectType', 'thread');
+                             'objectType', 'thread',
+                             'crc32', crc32($notice->content));
         $result = $conv->insert();
 
         if ($result === false) {