mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merged fix from 1.6 for Bug #5131 - RSS Feeds and Moving Discussions.
This commit is contained in:
parent
b6640a76ba
commit
b134f6a71e
2 changed files with 31 additions and 3 deletions
|
@ -57,8 +57,26 @@
|
|||
if (!forum_move_attachments($discussion, $move)) {
|
||||
notify("Errors occurred while moving attachment directories - check your file permissions");
|
||||
}
|
||||
set_field("forum_discussions", "forum", $forum->id, "id", $discussion->id);
|
||||
|
||||
if (!$fromforum = get_record("forum", "id", $discussion->forum)) {
|
||||
notify('Bad forum ID stored in this discussion');
|
||||
}
|
||||
$discussion->forum = $forum->id;
|
||||
$discussion->timemodified = time();
|
||||
|
||||
if (update_record('forum_discussions', $discussion)) {
|
||||
// Update RSS feeds for both from and to forums.
|
||||
require_once('rsslib.php');
|
||||
require_once($CFG->libdir.'/rsslib.php');
|
||||
|
||||
// Delete the RSS files for the 2 forums because we want to force
|
||||
// the regeneration of the feeds since the discussions have been
|
||||
// moved.
|
||||
if (!forum_rss_delete_file($forum) || !forum_rss_delete_file($fromforum)) {
|
||||
error('Could not purge the cached RSS feeds for the source and/or destination forums');
|
||||
}
|
||||
}
|
||||
|
||||
if ($cm = get_coursemodule_from_instance("forum", $forum->id, $course->id)) {
|
||||
add_to_log($course->id, "forum", "move discussion", "discuss.php?d=$discussion->id", "$discussion->id",
|
||||
$cm->id);
|
||||
|
|
|
@ -79,6 +79,16 @@
|
|||
return $status;
|
||||
}
|
||||
|
||||
|
||||
// Given a forum object, deletes the RSS file
|
||||
function forum_rss_delete_file($forum) {
|
||||
global $CFG;
|
||||
//return unlink("{$CFG->dataroot}/rss/{$modname}/{$forum->id}.xml");
|
||||
$rssfile = rss_file_name('forum', $forum);
|
||||
return unlink($rssfile);
|
||||
}
|
||||
|
||||
|
||||
function forum_rss_newstuff($forum, $time) {
|
||||
// If there is new stuff in the forum since $time then this returns
|
||||
// true. Otherwise it returns false.
|
||||
|
@ -158,7 +168,7 @@
|
|||
$items = array();
|
||||
|
||||
if ($newsince) {
|
||||
$newsince = " AND p.modified > '$newsince'";
|
||||
$newsince = " AND (p.modified > '$newsince' OR d.timemodified > '$newsince')";
|
||||
} else {
|
||||
$newsince = "";
|
||||
}
|
||||
|
@ -218,7 +228,7 @@
|
|||
$items = array();
|
||||
|
||||
if ($newsince) {
|
||||
$newsince = " AND p.modified > '$newsince'";
|
||||
$newsince = " AND (p.modified > '$newsince' OR d.timemodified > '$newsince')";
|
||||
} else {
|
||||
$newsince = "";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue