original_string: public function delete_question($questionid, $contextid) {
          global $DB;
  
          $this->delete_files($questionid, $contextid);
  
          $extraquestionfields = $this->extra_question_fields();
          if (is_array($extraquestionfields)) {
              $question_extension_table = array_shift($extraquestionfields);
              $DB->delete_records($question_extension_table,
                      array($this->questionid_column_name() => $questionid));
          }
  
          $extraanswerfields = $this->extra_answer_fields();
          if (is_array($extraanswerfields)) {
              $answer_extension_table = array_shift($extraanswerfields);
              $DB->delete_records_select($answer_extension_table,
                      'answerid IN (SELECT qa.id FROM {question_answers} qa WHERE qa.question = ?)',
                      array($questionid));
          }
  
          $DB->delete_records('question_answers', array('question' => $questionid));
  
          $DB->delete_records('question_hints', array('questionid' => $questionid));
      }
code: public function delete_question($questionid, $contextid) {
          global $DB;
  
          $this->delete_files($questionid, $contextid);
  
          $extraquestionfields = $this->extra_question_fields();
          if (is_array($extraquestionfields)) {
              $question_extension_table = array_shift($extraquestionfields);
              $DB->delete_records($question_extension_table,
                      array($this->questionid_column_name() => $questionid));
          }
  
          $extraanswerfields = $this->extra_answer_fields();
          if (is_array($extraanswerfields)) {
              $answer_extension_table = array_shift($extraanswerfields);
              $DB->delete_records_select($answer_extension_table,
                      'answerid IN (SELECT qa.id FROM {question_answers} qa WHERE qa.question = ?)',
                      array($questionid));
          }
  
          $DB->delete_records('question_answers', array('question' => $questionid));
  
          $DB->delete_records('question_hints', array('questionid' => $questionid));
      }
code_tokens: public function delete_question ( $ questionid , $ contextid ) { global $ DB ; $ this -> delete_files ( $ questionid , $ contextid ) ; $ extraquestionfields = $ this -> extra_question_fields ( ) ; if ( is_array ( $ extraquestionfields ) ) { $ question_extension_table = array_shift ( $ extraquestionfields ) ; $ DB -> delete_records ( $ question_extension_table , array ( $ this -> questionid_column_name ( ) => $ questionid ) ) ; } $ extraanswerfields = $ this -> extra_answer_fields ( ) ; if ( is_array ( $ extraanswerfields ) ) { $ answer_extension_table = array_shift ( $ extraanswerfields ) ; $ DB -> delete_records_select ( $ answer_extension_table , 'answerid IN (SELECT qa.id FROM {question_answers} qa WHERE qa.question = ?)' , array ( $ questionid ) ) ; } $ DB -> delete_records ( 'question_answers' , array ( 'question' => $ questionid ) ) ; $ DB -> delete_records ( 'question_hints' , array ( 'questionid' => $ questionid ) ) ; }
docstring: Deletes the question-type specific data when a question is deleted.
  @param int $question the question being deleted.
  @param int $contextid the context this quesiotn belongs to.
docstring_tokens: Deletes the question - type specific data when a question is deleted .