mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
rss MDL-23315 fixed error when moving threads between forums
This commit is contained in:
parent
47ee1c356c
commit
a74bea1257
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user