mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-65252 core: final deprecation of forum_count_replies() function
This commit is contained in:
parent
3610f1ee3b
commit
8baf7d6e5f
@ -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.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user