original_string: public function delete_content() {
          global $CFG, $DB;
  
          blocks_delete_all_for_context($this->_id);
          filter_delete_all_for_context($this->_id);
  
          require_once($CFG->dirroot . '/comment/lib.php');
          comment::delete_comments(array('contextid'=>$this->_id));
  
          require_once($CFG->dirroot.'/rating/lib.php');
          $delopt = new stdclass();
          $delopt->contextid = $this->_id;
          $rm = new rating_manager();
          $rm->delete_ratings($delopt);
  
          // delete all files attached to this context
          $fs = get_file_storage();
          $fs->delete_area_files($this->_id);
  
          // Delete all repository instances attached to this context.
          require_once($CFG->dirroot . '/repository/lib.php');
          repository::delete_all_for_context($this->_id);
  
          // delete all advanced grading data attached to this context
          require_once($CFG->dirroot.'/grade/grading/lib.php');
          grading_manager::delete_all_for_context($this->_id);
  
          // now delete stuff from role related tables, role_unassign_all
          // and unenrol should be called earlier to do proper cleanup
          $DB->delete_records('role_assignments', array('contextid'=>$this->_id));
          $DB->delete_records('role_names', array('contextid'=>$this->_id));
          $this->delete_capabilities();
      }
code: public function delete_content() {
          global $CFG, $DB;
  
          blocks_delete_all_for_context($this->_id);
          filter_delete_all_for_context($this->_id);
  
          require_once($CFG->dirroot . '/comment/lib.php');
          comment::delete_comments(array('contextid'=>$this->_id));
  
          require_once($CFG->dirroot.'/rating/lib.php');
          $delopt = new stdclass();
          $delopt->contextid = $this->_id;
          $rm = new rating_manager();
          $rm->delete_ratings($delopt);
  
          // delete all files attached to this context
          $fs = get_file_storage();
          $fs->delete_area_files($this->_id);
  
          // Delete all repository instances attached to this context.
          require_once($CFG->dirroot . '/repository/lib.php');
          repository::delete_all_for_context($this->_id);
  
          // delete all advanced grading data attached to this context
          require_once($CFG->dirroot.'/grade/grading/lib.php');
          grading_manager::delete_all_for_context($this->_id);
  
          // now delete stuff from role related tables, role_unassign_all
          // and unenrol should be called earlier to do proper cleanup
          $DB->delete_records('role_assignments', array('contextid'=>$this->_id));
          $DB->delete_records('role_names', array('contextid'=>$this->_id));
          $this->delete_capabilities();
      }
code_tokens: public function delete_content ( ) { global $ CFG , $ DB ; blocks_delete_all_for_context ( $ this -> _id ) ; filter_delete_all_for_context ( $ this -> _id ) ; require_once ( $ CFG -> dirroot . '/comment/lib.php' ) ; comment :: delete_comments ( array ( 'contextid' => $ this -> _id ) ) ; require_once ( $ CFG -> dirroot . '/rating/lib.php' ) ; $ delopt = new stdclass ( ) ; $ delopt -> contextid = $ this -> _id ; $ rm = new rating_manager ( ) ; $ rm -> delete_ratings ( $ delopt ) ; // delete all files attached to this context $ fs = get_file_storage ( ) ; $ fs -> delete_area_files ( $ this -> _id ) ; // Delete all repository instances attached to this context. require_once ( $ CFG -> dirroot . '/repository/lib.php' ) ; repository :: delete_all_for_context ( $ this -> _id ) ; // delete all advanced grading data attached to this context require_once ( $ CFG -> dirroot . '/grade/grading/lib.php' ) ; grading_manager :: delete_all_for_context ( $ this -> _id ) ; // now delete stuff from role related tables, role_unassign_all // and unenrol should be called earlier to do proper cleanup $ DB -> delete_records ( 'role_assignments' , array ( 'contextid' => $ this -> _id ) ) ; $ DB -> delete_records ( 'role_names' , array ( 'contextid' => $ this -> _id ) ) ; $ this -> delete_capabilities ( ) ; }
docstring: Delete all data linked to content, do not delete the context record itself
docstring_tokens: Delete all data linked to content do not delete the context record itself