original_string: public static function delete_data_for_all_users_in_context(\context $context) {
          global $CFG, $DB;
          require_once($CFG->libdir.'/gradelib.php');
  
          if ($context->contextlevel != CONTEXT_MODULE) {
              return;
          }
  
          $cm = get_coursemodule_from_id('workshop', $context->instanceid, 0, false, IGNORE_MISSING);
  
          if (!$cm) {
              // Probably some kind of expired context.
              return;
          }
  
          $workshop = $DB->get_record('workshop', ['id' => $cm->instance], 'id, course', MUST_EXIST);
  
          $submissions = $DB->get_records('workshop_submissions', ['workshopid' => $workshop->id], '', 'id');
          $assessments = $DB->get_records_list('workshop_assessments', 'submissionid', array_keys($submissions), '', 'id');
  
          $DB->delete_records('workshop_aggregations', ['workshopid' => $workshop->id]);
          $DB->delete_records_list('workshop_grades', 'assessmentid', array_keys($assessments));
          $DB->delete_records_list('workshop_assessments', 'id', array_keys($assessments));
          $DB->delete_records_list('workshop_submissions', 'id', array_keys($submissions));
  
          $fs = get_file_storage();
          $fs->delete_area_files($context->id, 'mod_workshop', 'submission_content');
          $fs->delete_area_files($context->id, 'mod_workshop', 'submission_attachment');
          $fs->delete_area_files($context->id, 'mod_workshop', 'overallfeedback_content');
          $fs->delete_area_files($context->id, 'mod_workshop', 'overallfeedback_attachment');
  
          grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 0, null, ['reset' => true]);
          grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 1, null, ['reset' => true]);
  
          \core_plagiarism\privacy\provider::delete_plagiarism_for_context($context);
      }
code: public static function delete_data_for_all_users_in_context(\context $context) {
          global $CFG, $DB;
          require_once($CFG->libdir.'/gradelib.php');
  
          if ($context->contextlevel != CONTEXT_MODULE) {
              return;
          }
  
          $cm = get_coursemodule_from_id('workshop', $context->instanceid, 0, false, IGNORE_MISSING);
  
          if (!$cm) {
              // Probably some kind of expired context.
              return;
          }
  
          $workshop = $DB->get_record('workshop', ['id' => $cm->instance], 'id, course', MUST_EXIST);
  
          $submissions = $DB->get_records('workshop_submissions', ['workshopid' => $workshop->id], '', 'id');
          $assessments = $DB->get_records_list('workshop_assessments', 'submissionid', array_keys($submissions), '', 'id');
  
          $DB->delete_records('workshop_aggregations', ['workshopid' => $workshop->id]);
          $DB->delete_records_list('workshop_grades', 'assessmentid', array_keys($assessments));
          $DB->delete_records_list('workshop_assessments', 'id', array_keys($assessments));
          $DB->delete_records_list('workshop_submissions', 'id', array_keys($submissions));
  
          $fs = get_file_storage();
          $fs->delete_area_files($context->id, 'mod_workshop', 'submission_content');
          $fs->delete_area_files($context->id, 'mod_workshop', 'submission_attachment');
          $fs->delete_area_files($context->id, 'mod_workshop', 'overallfeedback_content');
          $fs->delete_area_files($context->id, 'mod_workshop', 'overallfeedback_attachment');
  
          grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 0, null, ['reset' => true]);
          grade_update('mod/workshop', $workshop->course, 'mod', 'workshop', $workshop->id, 1, null, ['reset' => true]);
  
          \core_plagiarism\privacy\provider::delete_plagiarism_for_context($context);
      }
code_tokens: public static function delete_data_for_all_users_in_context ( \ context $ context ) { global $ CFG , $ DB ; require_once ( $ CFG -> libdir . '/gradelib.php' ) ; if ( $ context -> contextlevel != CONTEXT_MODULE ) { return ; } $ cm = get_coursemodule_from_id ( 'workshop' , $ context -> instanceid , 0 , false , IGNORE_MISSING ) ; if ( ! $ cm ) { // Probably some kind of expired context. return ; } $ workshop = $ DB -> get_record ( 'workshop' , [ 'id' => $ cm -> instance ] , 'id, course' , MUST_EXIST ) ; $ submissions = $ DB -> get_records ( 'workshop_submissions' , [ 'workshopid' => $ workshop -> id ] , '' , 'id' ) ; $ assessments = $ DB -> get_records_list ( 'workshop_assessments' , 'submissionid' , array_keys ( $ submissions ) , '' , 'id' ) ; $ DB -> delete_records ( 'workshop_aggregations' , [ 'workshopid' => $ workshop -> id ] ) ; $ DB -> delete_records_list ( 'workshop_grades' , 'assessmentid' , array_keys ( $ assessments ) ) ; $ DB -> delete_records_list ( 'workshop_assessments' , 'id' , array_keys ( $ assessments ) ) ; $ DB -> delete_records_list ( 'workshop_submissions' , 'id' , array_keys ( $ submissions ) ) ; $ fs = get_file_storage ( ) ; $ fs -> delete_area_files ( $ context -> id , 'mod_workshop' , 'submission_content' ) ; $ fs -> delete_area_files ( $ context -> id , 'mod_workshop' , 'submission_attachment' ) ; $ fs -> delete_area_files ( $ context -> id , 'mod_workshop' , 'overallfeedback_content' ) ; $ fs -> delete_area_files ( $ context -> id , 'mod_workshop' , 'overallfeedback_attachment' ) ; grade_update ( 'mod/workshop' , $ workshop -> course , 'mod' , 'workshop' , $ workshop -> id , 0 , null , [ 'reset' => true ] ) ; grade_update ( 'mod/workshop' , $ workshop -> course , 'mod' , 'workshop' , $ workshop -> id , 1 , null , [ 'reset' => true ] ) ; \ core_plagiarism \ privacy \ provider :: delete_plagiarism_for_context ( $ context ) ; }
docstring: Delete personal data for all users in the context.
  
  @param context $context Context to delete personal data from.
docstring_tokens: Delete personal data for all users in the context .