Skip to content

Commit

Permalink
MDL-29086 - data - Fix for allowing the deletion of database activity…
Browse files Browse the repository at this point in the history
… presets.

Thank you to Matthias Hunstock for providing a patch for this.
  • Loading branch information
abgreeve committed Mar 2, 2012
1 parent f24a1a7 commit f123887
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mod/data/lib.php
Expand Up @@ -3117,13 +3117,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));
Expand Down
3 changes: 1 addition & 2 deletions mod/data/preset.php
Expand Up @@ -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');
Expand Down

0 comments on commit f123887

Please sign in to comment.