rss MDL-23315 fixed error when moving threads between forums

This commit is contained in:
Andrew Davis 2010-07-16 02:46:26 +00:00
parent 47ee1c356c
commit a74bea1257
2 changed files with 11 additions and 11 deletions

View File

@ -81,11 +81,14 @@ function rss_print_link($contextid, $userid, $modulename, $id, $tooltiptext='')
function rss_delete_file($modname, $instance) {
global $CFG;
$dh = opendir("$CFG->dataroot/rss/$modname");
while (false !== ($filename = readdir($dh))) {
if ($filename!='.' && $filename!='..') {
if (preg_match("/{$instance->id}_/", $filename)) {
unlink("$CFG->dataroot/rss/$modname/$filename");
$dirpath = "$CFG->dataroot/rss/$modname";
if (is_dir($dirpath)) {
$dh = opendir($dirpath);
while (false !== ($filename = readdir($dh))) {
if ($filename!='.' && $filename!='..') {
if (preg_match("/{$instance->id}_/", $filename)) {
unlink("$CFG->dataroot/rss/$modname/$filename");
}
}
}
}

View File

@ -129,12 +129,9 @@
require_once($CFG->libdir.'/rsslib.php');
require_once('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($forumto)) {
print_error('cannotpurgecachedrss', 'forum', $return);
}
// Delete the RSS files for the 2 forums to force regeneration of the feeds
forum_rss_delete_file($forum);
forum_rss_delete_file($forumto);
redirect($return.'&moved=-1&sesskey='.sesskey());
}