From 74138e927c0d26ba652898cff1f96fd588994523 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 26 Oct 2018 14:54:01 +0800 Subject: [PATCH] Revert "MDL-63466 core_message: rename cache for last message time" This reverts commit f978593d6c3b98db5b3feb29448a642b4f540edc. --- lang/en/cache.php | 2 +- lib/db/caches.php | 4 ++-- lib/messagelib.php | 2 +- message/classes/api.php | 2 +- ...conversation.php => time_last_message_between_users.php} | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) rename message/classes/{time_last_message_in_conversation.php => time_last_message_between_users.php} (91%) diff --git a/lang/en/cache.php b/lang/en/cache.php index 3a8c0b84dc83a..eaef8601158d2 100644 --- a/lang/en/cache.php +++ b/lang/en/cache.php @@ -55,7 +55,7 @@ $string['cachedef_groupdata'] = 'Course group information'; $string['cachedef_htmlpurifier'] = 'HTML Purifier - cleaned content'; $string['cachedef_langmenu'] = 'List of available languages'; -$string['cachedef_message_time_last_message_in_conversation'] = 'Time created for most recent message in a conversation'; +$string['cachedef_message_time_last_message_between_users'] = 'Time created for most recent message in a conversation'; $string['cachedef_locking'] = 'Locking'; $string['cachedef_message_processors_enabled'] = "Message processors enabled status"; $string['cachedef_contextwithinsights'] = 'Context with insights'; diff --git a/lib/db/caches.php b/lib/db/caches.php index ce6807d7f1451..aa265c6da9d0e 100644 --- a/lib/db/caches.php +++ b/lib/db/caches.php @@ -343,11 +343,11 @@ ), // Caches the time of the last message in a conversation. - 'message_time_last_message_in_conversation' => array( + 'message_time_last_message_between_users' => array( 'mode' => cache_store::MODE_APPLICATION, 'simplekeys' => true, // The conversation id is used. 'simplevalues' => true, - 'datasource' => '\core_message\time_last_message_in_conversation', + 'datasource' => '\core_message\time_last_message_between_users', ), // Caches font awesome icons. diff --git a/lib/messagelib.php b/lib/messagelib.php index deca4e615d739..66b2002d6a104 100644 --- a/lib/messagelib.php +++ b/lib/messagelib.php @@ -294,7 +294,7 @@ function message_send(\core\message\message $eventdata) { if (!$eventdata->notification) { if (!empty($eventdata->convid)) { // Cache the timecreated value of the last message in this conversation. - $cache = cache::make('core', 'message_time_last_message_in_conversation'); + $cache = cache::make('core', 'message_time_last_message_between_users'); $key = \core_message\helper::get_last_message_time_created_cache_key($eventdata->convid); $cache->set($key, $tabledata->timecreated); } diff --git a/message/classes/api.php b/message/classes/api.php index 57619cff7c0c2..ee60a6bf69c2f 100644 --- a/message/classes/api.php +++ b/message/classes/api.php @@ -667,7 +667,7 @@ public static function get_conversation_messages(int $userid, int $convid, int $ if (!empty($timefrom)) { // Check the cache to see if we even need to do a DB query. - $cache = \cache::make('core', 'message_time_last_message_in_conversation'); + $cache = \cache::make('core', 'message_time_last_message_between_users'); $key = helper::get_last_message_time_created_cache_key($convid); $lastcreated = $cache->get($key); diff --git a/message/classes/time_last_message_in_conversation.php b/message/classes/time_last_message_between_users.php similarity index 91% rename from message/classes/time_last_message_in_conversation.php rename to message/classes/time_last_message_between_users.php index d430a478226a5..8f7e99a05e6f0 100644 --- a/message/classes/time_last_message_in_conversation.php +++ b/message/classes/time_last_message_between_users.php @@ -35,9 +35,9 @@ * @copyright 2016 Ryan Wyllie * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class time_last_message_in_conversation implements \cache_data_source { +class time_last_message_between_users implements \cache_data_source { - /** @var time_last_message_in_conversation the singleton instance of this class. */ + /** @var time_last_message_between_users the singleton instance of this class. */ protected static $instance = null; /** @@ -49,7 +49,7 @@ class time_last_message_in_conversation implements \cache_data_source { */ public static function get_instance_for_cache(\cache_definition $definition) { if (is_null(self::$instance)) { - self::$instance = new time_last_message_in_conversation(); + self::$instance = new time_last_message_between_users(); } return self::$instance; }