Increase the likeliness of generating an unique "stats_id" #7988
Replies: 5 comments
-
uniqid results are typically 23 characters long (2^184 combinations) and stats IDs are created once per OJS/OMP/OPS installation; is this actually a problem? |
Beta Was this translation helpful? Give feedback.
-
I think the uniqid is ok, so it's just a safer suggestion, GUIDs are great for such cases (banking systems normally use them), have a fixed length, etc., I can't see drawbacks 🤔 Another cool use is to replace auto-incrementing IDs, which have its pros (we don't even need to request the "inserted ID" from the database, as the ID can be generated by the client, naturally obfuscated, ...) and cons (bigger size, not easy to be sorted, ...). |
Beta Was this translation helpful? Give feedback.
-
The GUID has been implemented at #9136, see: https://github.com/pkp/pkp-lib/pull/9232/files#diff-a90b36dbf19885494106c6ec34cc0204c08f1b195de2d93abd68d694e963d53bR290 |
Beta Was this translation helpful? Give feedback.
-
ps: I don't have permission to change the category to "Accepted Proposal" 😁 |
Beta Was this translation helpful? Give feedback.
-
Changed! |
Beta Was this translation helpful? Give feedback.
-
Given the uniqid function isn't that great for the task, perhaps we could use a package to generate GUIDs (e.g. https://packagist.org/packages/ramsey/uuid).
Beta Was this translation helpful? Give feedback.
All reactions