Permalink
Browse files

MDL-29086 - data - Fix for allowing the deletion of database activity…

… presets.

Thank you to Matthias Hunstock for providing the patch for this.
  • Loading branch information...
1 parent 5bbf3cb commit 901d58dfd358cc58939cb28da4930c8fba0ddcb1 @abgreeve abgreeve committed Feb 23, 2012
Showing with 3 additions and 2 deletions.
  1. +2 −0 mod/data/lib.php
  2. +1 −2 mod/data/preset.php
View
@@ -3121,13 +3121,15 @@ function data_extend_settings_navigation(settings_navigation $settings, navigati
* @return bool
*/
function data_presets_save($course, $cm, $data, $path) {
+ global $USER;
$fs = get_file_storage();
$filerecord = new stdClass;
$filerecord->contextid = DATA_PRESET_CONTEXT;
$filerecord->component = DATA_PRESET_COMPONENT;
$filerecord->filearea = DATA_PRESET_FILEAREA;
$filerecord->itemid = 0;
$filerecord->filepath = '/'.$path.'/';
+ $filerecord->userid = $USER->id;
$filerecord->filename = 'preset.xml';
$fs->create_file_from_string($filerecord, data_presets_generate_xml($course, $cm, $data));
View
@@ -183,8 +183,7 @@
print_error('invalidrequest');
}
- $presetpath = data_preset_path($course, $userid, $shortname);
- fulldelete($presetpath);
+ data_delete_site_preset($shortname);
$strdeleted = get_string('deleted', 'data');
echo $OUTPUT->notification("$shortname $strdeleted", 'notifysuccess');

0 comments on commit 901d58d

Please sign in to comment.