MDL-65252 core: final deprecation of forum_count_replies() function

This commit is contained in:
Simey Lameze 2020-11-18 07:49:59 +08:00
parent 3610f1ee3b
commit 8baf7d6e5f
2 changed files with 7 additions and 26 deletions

View File

@ -1621,34 +1621,11 @@ function forum_print_latest_discussions($course, $forum, $maxdiscussions = -1, $
}
/**
* Count the number of replies to the specified post.
*
* @param object $post
* @param bool $children
* @return int
* @deprecated since Moodle 3.7
* @todo MDL-65252 This will be removed in Moodle 3.11
*/
function forum_count_replies($post, $children = true) {
global $USER;
debugging('forum_count_replies has been deprecated. Please use the Post vault instead.', DEBUG_DEVELOPER);
if (!$children) {
return $DB->count_records('forum_posts', array('parent' => $post->id));
}
$entityfactory = mod_forum\local\container::get_entity_factory();
$postentity = $entityfactory->get_post_from_stdclass($post);
$vaultfactory = mod_forum\local\container::get_vault_factory();
$postvault = $vaultfactory->get_post_vault();
return $postvault->get_reply_count_for_post_id_in_discussion_id(
$USER,
$postentity->get_id(),
$postentity->get_discussion_id(),
true
);
function forum_count_replies() {
throw new coding_exception(__FUNCTION__ . ' has been removed. Please use get_reply_count_for_post_id_in_discussion_id in
the post vault.');
}
/**

View File

@ -1,6 +1,10 @@
This files describes API changes in /mod/forum/*,
information provided here is intended especially for developers.
=== 4.0 ===
* The forum_count_replies() function has been removed from core.
=== 3.11 ===
* The get_forum_discussions_paginated web service has been deprecated in favour of get_forum_discussions.