Permalink
Browse files

MDL-48004 question: remove buggy arg of question_edit_setup

There are no uses of this in core and it does not make sense
  • Loading branch information...
danpoltawski committed Nov 26, 2015
1 parent 4dc29f5 commit 5aeba19926fa4ed15b5a458ea851102b1001dab1
Showing with 17 additions and 15 deletions.
  1. +11 −15 question/editlib.php
  2. +6 −0 question/upgrade.txt
View
@@ -260,11 +260,15 @@ class_alias('core_question\bank\view', 'question_bank_view', true);
* @param string $baseurl the name of the script calling this funciton. For examle 'qusetion/edit.php'.
* @param string $edittab code for this edit tab
* @param bool $requirecmid require cmid? default false
* @param bool $requirecourseid require courseid, if cmid is not given? default true
* @param bool $unused no longer used, do no pass
* @return array $thispageurl, $contexts, $cmid, $cm, $module, $pagevars
*/
function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirecourseid = true) {
global $DB, $PAGE;
function question_edit_setup($edittab, $baseurl, $requirecmid = false, $unused = null) {
global $DB, $PAGE, $CFG;
if ($unused !== null) {
debugging('Deprecated argument passed to question_edit_setup()', DEBUG_DEVELOPER);
}
$thispageurl = new moodle_url($baseurl);
$thispageurl->remove_all_params(); // We are going to explicity add back everything important - this avoids unwanted params from being retained.
@@ -283,18 +287,10 @@ function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirec
} else {
$module = null;
$cm = null;
if ($requirecourseid){
$courseid = required_param('courseid', PARAM_INT);
} else {
$courseid = optional_param('courseid', 0, PARAM_INT);
}
if ($courseid){
$thispageurl->params(compact('courseid'));
require_login($courseid, false);
$thiscontext = context_course::instance($courseid);
} else {
$thiscontext = null;
}
$courseid = required_param('courseid', PARAM_INT);
$thispageurl->params(compact('courseid'));
require_login($courseid, false);
$thiscontext = context_course::instance($courseid);
}
if ($thiscontext){
View
@@ -1,5 +1,11 @@
This files describes API changes for code that uses the question API.
=== 3.1 ===
1) The argument $requirecourseid was removed from question_edit_setup() and
is no longer respected. The behaviour was found to be buggy and now throws
debugging notices if passed.
=== 2.9 ===
1) Some functions in questionlib.php which were deprecated in the past have now

0 comments on commit 5aeba19

Please sign in to comment.