Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit d1deac2d80ae9a4a7a4bfb2c79b7a5b8bf9b4a38 1 parent e356fb6
Adrian Greeve authored February 23, 2012
2  mod/data/lib.php
@@ -3118,6 +3118,7 @@ function data_extend_settings_navigation(settings_navigation $settings, navigati
3118 3118
  * @return bool
3119 3119
  */
3120 3120
 function data_presets_save($course, $cm, $data, $path) {
  3121
+    global $USER;
3121 3122
     $fs = get_file_storage();
3122 3123
     $filerecord = new stdClass;
3123 3124
     $filerecord->contextid = DATA_PRESET_CONTEXT;
@@ -3125,6 +3126,7 @@ function data_presets_save($course, $cm, $data, $path) {
3125 3126
     $filerecord->filearea = DATA_PRESET_FILEAREA;
3126 3127
     $filerecord->itemid = 0;
3127 3128
     $filerecord->filepath = '/'.$path.'/';
  3129
+    $filerecord->userid = $USER->id;
3128 3130
 
3129 3131
     $filerecord->filename = 'preset.xml';
3130 3132
     $fs->create_file_from_string($filerecord, data_presets_generate_xml($course, $cm, $data));
3  mod/data/preset.php
@@ -183,8 +183,7 @@
183 183
                print_error('invalidrequest');
184 184
             }
185 185
 
186  
-            $presetpath = data_preset_path($course, $userid, $shortname);
187  
-            fulldelete($presetpath);
  186
+            data_delete_site_preset($shortname);
188 187
 
189 188
             $strdeleted = get_string('deleted', 'data');
190 189
             echo $OUTPUT->notification("$shortname $strdeleted", 'notifysuccess');

0 notes on commit d1deac2

Please sign in to comment.
Something went wrong with that request. Please try again.