Skip to content

Commit

Permalink
MDL-48259 questionlib.php: remove functions deprecated in Moodle 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Nov 17, 2014
1 parent c106341 commit 4c3c1b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 65 deletions.
65 changes: 0 additions & 65 deletions lib/questionlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,6 @@ function question_save_qtype_order($neworder, $config = null) {

/// FUNCTIONS //////////////////////////////////////////////////////

/**
* Returns an array of names of activity modules that use this question
*
* @deprecated since Moodle 2.1. Use {@link questions_in_use} instead.
*
* @param object $questionid
* @return array of strings
*/
function question_list_instances($questionid) {
throw new coding_exception('question_list_instances has been deprectated. ' .
'Please use questions_in_use instead.');
}

/**
* @param array $questionids of question ids.
* @return boolean whether any of these questions are being used by any part of Moodle.
Expand Down Expand Up @@ -191,23 +178,6 @@ function question_context_has_any_questions($context) {
WHERE qc.contextid = ? AND q.parent = 0", array($contextid));
}

/**
* Returns list of 'allowed' grades for grade selection
* formatted suitably for dropdown box function
*
* @deprecated since 2.1. Use {@link question_bank::fraction_options()} or
* {@link question_bank::fraction_options_full()} instead.
*
* @return object ->gradeoptionsfull full array ->gradeoptions +ve only
*/
function get_grade_options() {
$grades = new stdClass();
$grades->gradeoptions = question_bank::fraction_options();
$grades->gradeoptionsfull = question_bank::fraction_options_full();

return $grades;
}

/**
* Check whether a given grade is one of a list of allowed options. If not,
* depending on $matchgrades, either return the nearest match, or return false
Expand Down Expand Up @@ -250,17 +220,6 @@ function match_grade_options($gradeoptionsfull, $grade, $matchgrades = 'error')
}
}

/**
* @deprecated Since Moodle 2.1. Use {@link question_category_in_use} instead.
* @param integer $categoryid a question category id.
* @param boolean $recursive whether to check child categories too.
* @return boolean whether any question in this category is in use.
*/
function question_category_isused($categoryid, $recursive = false) {
throw new coding_exception('question_category_isused has been deprectated. ' .
'Please use question_category_in_use instead.');
}

/**
* Tests whether any question in a category is used by any part of Moodle.
*
Expand Down Expand Up @@ -892,19 +851,6 @@ function question_hash($question) {
return make_unique_id_code();
}

/// FUNCTIONS THAT SIMPLY WRAP QUESTIONTYPE METHODS //////////////////////////////////
/**
* Saves question options
*
* Simply calls the question type specific save_question_options() method.
* @deprecated all code should now call the question type method directly.
*/
function save_question_options($question) {
debugging('Please do not call save_question_options any more. Call the question type method directly.',
DEBUG_DEVELOPER);
question_bank::get_qtype($question->qtype)->save_question_options($question);
}

/// CATEGORY FUNCTIONS /////////////////////////////////////////////////////////////////

/**
Expand Down Expand Up @@ -1429,17 +1375,6 @@ function question_require_capability_on($question, $cap) {
return true;
}

/**
* Get the real state - the correct question id and answer - for a random
* question.
* @param object $state with property answer.
* @deprecated this function has not been relevant since Moodle 2.1!
*/
function question_get_real_state($state) {
throw new coding_exception('question_get_real_state has not been relevant since Moodle 2.1. ' .
'I am not sure what you are trying to do, but stop it at once!');
}

/**
* @param object $context a context
* @return string A URL for editing questions in this context.
Expand Down
13 changes: 13 additions & 0 deletions question/upgrade.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
This files describes API changes for code that uses the question API.

=== 2.9 ===

1) Some functions in questionlib.php where were deprecated in the past have now
beed deleted:

Deprecated since 2.1
* question_list_instances
* get_grade_options
* question_category_isused
* save_question_options
* question_get_real_state


=== 2.8 ===

1) This is jsut a warning that some methods of the question_engine_data_mapper
Expand Down

0 comments on commit 4c3c1b5

Please sign in to comment.