Adding crc32 to uniqueify conversation URIs

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.
This commit is contained in:
Mikael Nordfeldth 2014-11-27 17:05:01 +01:00
parent 72d1c3c73e
commit 9f09b136b8
1 changed files with 3 additions and 2 deletions

View 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) {