MDL-48004 question: remove buggy arg of question_edit_setup

There are no uses of this in core and it does not make sense
This commit is contained in:
Dan Poltawski 2015-11-26 15:04:10 +00:00
parent 4dc29f5e8d
commit 5aeba19926
2 changed files with 17 additions and 15 deletions

View File

@ -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 $baseurl the name of the script calling this funciton. For examle 'qusetion/edit.php'.
* @param string $edittab code for this edit tab * @param string $edittab code for this edit tab
* @param bool $requirecmid require cmid? default false * @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 * @return array $thispageurl, $contexts, $cmid, $cm, $module, $pagevars
*/ */
function question_edit_setup($edittab, $baseurl, $requirecmid = false, $requirecourseid = true) { function question_edit_setup($edittab, $baseurl, $requirecmid = false, $unused = null) {
global $DB, $PAGE; global $DB, $PAGE, $CFG;
if ($unused !== null) {
debugging('Deprecated argument passed to question_edit_setup()', DEBUG_DEVELOPER);
}
$thispageurl = new moodle_url($baseurl); $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. $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 { } else {
$module = null; $module = null;
$cm = null; $cm = null;
if ($requirecourseid){ $courseid = required_param('courseid', PARAM_INT);
$courseid = required_param('courseid', PARAM_INT); $thispageurl->params(compact('courseid'));
} else { require_login($courseid, false);
$courseid = optional_param('courseid', 0, PARAM_INT); $thiscontext = context_course::instance($courseid);
}
if ($courseid){
$thispageurl->params(compact('courseid'));
require_login($courseid, false);
$thiscontext = context_course::instance($courseid);
} else {
$thiscontext = null;
}
} }
if ($thiscontext){ if ($thiscontext){

View File

@ -1,5 +1,11 @@
This files describes API changes for code that uses the question API. 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 === === 2.9 ===
1) Some functions in questionlib.php which were deprecated in the past have now 1) Some functions in questionlib.php which were deprecated in the past have now