mirror of
https://github.com/moodle/moodle.git
synced 2025-04-15 05:25:08 +02:00
Merge branch 'MDL-42467_database' of https://github.com/andyjdavis/moodle
This commit is contained in:
commit
9d8c363927
@ -3704,7 +3704,7 @@ function data_user_can_delete_preset($context, $preset) {
|
||||
* @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) {
|
||||
@ -3717,6 +3717,12 @@ function data_delete_record($recordid, $data, $courseid, $cmid) {
|
||||
$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,
|
||||
|
@ -177,3 +177,15 @@
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -114,6 +114,12 @@ if ($confirm and confirm_sesskey()) { // the operation was confirmed.
|
||||
$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,
|
||||
|
@ -196,4 +196,14 @@
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user