* @return bool True if the record deleted, false if not.
*/
function data_delete_record($recordid, $data, $courseid, $cmid) {
- global $DB;
+ global $DB, $CFG;
if ($deleterecord = $DB->get_record('data_records', array('id' => $recordid))) {
if ($deleterecord->dataid == $data->id) {
$DB->delete_records('data_content', array('recordid'=>$deleterecord->id));
$DB->delete_records('data_records', array('id'=>$deleterecord->id));
+ // Delete cached RSS feeds.
+ if (!empty($CFG->enablerssfeeds)) {
+ require_once($CFG->dirroot.'/mod/data/rsslib.php');
+ data_rss_delete_file($data);
+ }
+
// Trigger an event for deleting this record.
$event = \mod_data\event\record_deleted::create(array(
'objectid' => $deleterecord->id,
return ($recs && !empty($recs));
}
+ /**
+ * Given a database object, deletes all cached RSS files associated with it.
+ *
+ * @param stdClass $data
+ */
+ function data_rss_delete_file($data) {
+ global $CFG;
+ require_once("$CFG->libdir/rsslib.php");
+
+ rss_delete_file('mod_data', $data);
+ }
+
$rm->delete_ratings($delopt);
}
+ // Delete cached RSS feeds.
+ if (!empty($CFG->enablerssfeeds)) {
+ require_once($CFG->dirroot.'/mod/glossary/rsslib.php');
+ glossary_rss_delete_file($glossary);
+ }
+
$event = \mod_glossary\event\entry_deleted::create(array(
'context' => $context,
'objectid' => $origentry->id,
return ($recs && !empty($recs));
}
-
+ /**
+ * Given a glossary object, deletes all cached RSS files associated with it.
+ *
+ * @param stdClass $glossary
+ */
+ function glossary_rss_delete_file($glossary) {
+ global $CFG;
+ require_once("$CFG->libdir/rsslib.php");
+
+ rss_delete_file('mod_glossary', $glossary);
+ }