Merge branch 'MDL-42467_database_26' of https://github.com/andyjdavis/moodle into MOODLE_26_STABLE

This commit is contained in:
Dan Poltawski
2014-06-30 15:09:54 +01:00
4 changed files with 37 additions and 1 deletions
+8 -1
View File
@@ -3671,7 +3671,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) {
@@ -3685,6 +3685,13 @@ function data_delete_record($recordid, $data, $courseid, $cmid) {
$DB->delete_records('data_records', array('id'=>$deleterecord->id));
add_to_log($courseid, 'data', 'record delete', "view.php?id=$cmid", $data->id, $cmid);
// Delete cached RSS feeds.
if (!empty($CFG->enablerssfeeds)) {
require_once($CFG->dirroot.'/mod/data/rsslib.php');
data_rss_delete_file($data);
}
return true;
}
}
+12
View File
@@ -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);
}
+7
View File
@@ -114,6 +114,13 @@ if ($confirm and confirm_sesskey()) { // the operation was confirmed.
}
add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&mode=$prevmode&hook=$hook", $entry->id,$cm->id);
// Delete cached RSS feeds.
if (!empty($CFG->enablerssfeeds)) {
require_once($CFG->dirroot.'/mod/glossary/rsslib.php');
glossary_rss_delete_file($glossary);
}
redirect("view.php?id=$cm->id&mode=$prevmode&hook=$hook");
} else { // the operation has not been confirmed yet so ask the user to do so
+10
View File
@@ -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);
}