Merge branch 'MDL-26170_rss_24' of https://github.com/andyjdavis/moodle into MOODLE_24_STABLE
This commit is contained in:
@@ -120,6 +120,7 @@ if ($action === 'delete'){
|
||||
print_error('nopermissionstodeleteentry', 'blog');
|
||||
} else {
|
||||
$entry->delete();
|
||||
blog_rss_delete_file($userid);
|
||||
redirect($returnurl);
|
||||
}
|
||||
} else if (blog_user_can_edit_entry($entry)) {
|
||||
|
||||
@@ -330,3 +330,17 @@ function blog_rss_save_file($type, $id, $tagid=0, $contents='') {
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the supplied user's cached blog post RSS feed.
|
||||
* Only user blogs are available by RSS.
|
||||
* This doesn't call rss_delete_file() as blog RSS caching uses it's own file structure.
|
||||
*
|
||||
* @param int $userid
|
||||
*/
|
||||
function blog_rss_delete_file($userid) {
|
||||
$filename = blog_rss_file_name('user', $userid);
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,10 +94,8 @@
|
||||
$DB->set_field('forum_read', 'forumid', $forumto->id, array('discussionid' => $discussion->id));
|
||||
add_to_log($course->id, 'forum', 'move discussion', "discuss.php?d=$discussion->id", $discussion->id, $cmto->id);
|
||||
|
||||
require_once($CFG->libdir.'/rsslib.php');
|
||||
require_once($CFG->dirroot.'/mod/forum/rsslib.php');
|
||||
|
||||
// Delete the RSS files for the 2 forums to force regeneration of the feeds
|
||||
require_once($CFG->dirroot.'/mod/forum/rsslib.php');
|
||||
forum_rss_delete_file($forum);
|
||||
forum_rss_delete_file($forumto);
|
||||
|
||||
|
||||
+8
-2
@@ -4516,7 +4516,7 @@ function forum_delete_post($post, $children, $course, $cm, $forum, $skipcompleti
|
||||
}
|
||||
}
|
||||
|
||||
//delete ratings
|
||||
// Delete ratings.
|
||||
require_once($CFG->dirroot.'/rating/lib.php');
|
||||
$delopt = new stdClass;
|
||||
$delopt->contextid = $context->id;
|
||||
@@ -4526,11 +4526,17 @@ function forum_delete_post($post, $children, $course, $cm, $forum, $skipcompleti
|
||||
$rm = new rating_manager();
|
||||
$rm->delete_ratings($delopt);
|
||||
|
||||
//delete attachments
|
||||
// Delete attachments.
|
||||
$fs = get_file_storage();
|
||||
$fs->delete_area_files($context->id, 'mod_forum', 'attachment', $post->id);
|
||||
$fs->delete_area_files($context->id, 'mod_forum', 'post', $post->id);
|
||||
|
||||
// Delete cached RSS feeds.
|
||||
if (!empty($CFG->enablerssfeeds)) {
|
||||
require_once($CFG->dirroot.'/mod/forum/rsslib.php');
|
||||
forum_rss_delete_file($forum);
|
||||
}
|
||||
|
||||
if ($DB->delete_records("forum_posts", array("id" => $post->id))) {
|
||||
|
||||
forum_tp_delete_read_records(-1, $post->id);
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/* Include the core RSS lib */
|
||||
require_once($CFG->libdir.'/rsslib.php');
|
||||
|
||||
/**
|
||||
* Returns the path to the cached rss feed contents. Creates/updates the cache if necessary.
|
||||
* @param stdClass $context the context
|
||||
@@ -68,9 +71,10 @@ function forum_rss_get_feed($context, $args) {
|
||||
$cachedfilelastmodified = filemtime($cachedfilepath);
|
||||
}
|
||||
// Used to determine if we need to generate a new RSS feed.
|
||||
$dontrecheckcutoff = time()-60;
|
||||
// If it hasn't been generated we will need to create it, otherwise only update
|
||||
// if there is new stuff to show and it is older than the cut off date set above.
|
||||
$dontrecheckcutoff = time() - 60; // Sixty seconds ago.
|
||||
|
||||
// If it hasn't been generated we need to create it.
|
||||
// Otherwise, if it has been > 60 seconds since we last updated, check for new items.
|
||||
if (($cachedfilelastmodified == 0) || (($dontrecheckcutoff > $cachedfilelastmodified) &&
|
||||
forum_rss_newstuff($forum, $cm, $cachedfilelastmodified))) {
|
||||
// Need to regenerate the cached version.
|
||||
|
||||
Reference in New Issue
Block a user