MDL-36941 core: added 'convhash' field to quickly get conversations

This commit is contained in:
Mark Nelson
2018-03-23 12:30:28 +08:00
parent 0d51ae7ef3
commit b2cd17e6a9
9 changed files with 65 additions and 42 deletions
+12
View File
@@ -293,6 +293,18 @@ class helper {
return $params;
}
/**
* Returns the conversation hash between users for easy look-ups in the DB.
*
* @param array $userids
* @return string
*/
public static function get_conversation_hash(array $userids) {
sort($userids);
return sha1(implode('-', $userids));
}
/**
* Returns the cache key for the time created value of the last message between two users.
*