From a74bea125754cf21baedb17081a9c373d8be1aac Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Fri, 16 Jul 2010 02:46:26 +0000 Subject: [PATCH] rss MDL-23315 fixed error when moving threads between forums --- lib/rsslib.php | 13 ++++++++----- mod/forum/discuss.php | 9 +++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/rsslib.php b/lib/rsslib.php index 930ae0e576d..5933dff8bf9 100644 --- a/lib/rsslib.php +++ b/lib/rsslib.php @@ -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"); + } } } } diff --git a/mod/forum/discuss.php b/mod/forum/discuss.php index 32e37913b06..ba482637d28 100644 --- a/mod/forum/discuss.php +++ b/mod/forum/discuss.php @@ -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()); }