MDL-71175 plagiarism: Deprecate some old functions.

This commit is contained in:
Dan Marsden 2021-04-14 14:51:51 +12:00
parent a747fd3055
commit 4b18cc0bb1
3 changed files with 25 additions and 2 deletions

View File

@ -56,6 +56,8 @@ function plagiarism_get_links($linkarray) {
/**
* returns array of plagiarism details about specified file
*
* @deprecated Since Moodle 4.0. - this function was a placeholder and not used in core.
* @todo MDL-71326 This is to be moved from here to deprecatedlib.php in Moodle 4.4
* @param int $cmid
* @param int $userid
* @param object $file moodle file object
@ -64,6 +66,8 @@ function plagiarism_get_links($linkarray) {
*/
function plagiarism_get_file_results($cmid, $userid, $file) {
global $CFG;
$text = 'plagiarism_get_file_results is deprecated, please use plagiarism_get_links() or plugin specific functions.';
debugging($text, DEBUG_DEVELOPER);
$allresults = array();
if (empty($CFG->enableplagiarism)) {
return $allresults;
@ -140,6 +144,8 @@ function plagiarism_get_form_elements_module($mform, $context, $modulename = "")
/**
* Allows a plagiarism plugin to print a button/link at the top of activity overview report pages.
*
* @deprecated Since Moodle 4.0 - Please use {plugin name}_before_standard_top_of_body_html instead.
* @todo MDL-71326 Remove this method.
* @param object $course - full Course object
* @param object $cm - full cm object
* @return string
@ -155,6 +161,13 @@ function plagiarism_update_status($course, $cm) {
require_once($dir.'/lib.php');
$plagiarismclass = "plagiarism_plugin_$plugin";
$plagiarismplugin = new $plagiarismclass;
$reflectionmethod = new ReflectionMethod($plagiarismplugin, 'update_status');
if ($reflectionmethod->getDeclaringClass()->getName() == get_class($plagiarismplugin)) {
$text = 'plagiarism_plugin::update_status() is deprecated.';
$text .= ' Use plagiarism_' . $plugin . '_before_standard_top_of_body_html() instead';
debugging($text, DEBUG_DEVELOPER);
}
$output .= $plagiarismplugin->update_status($course, $cm);
}
return $output;

View File

@ -41,7 +41,8 @@ abstract class plagiarism_plugin {
/**
* Return the list of form element names.
*
* @deprecated Since Moodle 4.0 - this function was a placeholder and not used in core.
* @todo MDL-71326 Remove this method.
* @return array contains the form element names.
*/
public function get_configs() {
@ -58,6 +59,8 @@ abstract class plagiarism_plugin {
}
/**
* hook to allow plagiarism specific information to be returned unformatted
* @deprecated Since Moodle 4.0 - this function was a placeholder and not used in core Moodle code.
* @todo MDL-71326 Remove this method.
* @param int $cmid
* @param int $userid
* @param $file file object
@ -96,7 +99,8 @@ abstract class plagiarism_plugin {
}
/**
* hook to allow status of submitted files to be updated - called on grading/report pages.
*
* @deprecated Since Moodle 4.0 - Please use {plugin name}_before_standard_top_of_body_html instead.
* @todo MDL-71326 Remove this method.
* @param object $course - full Course object
* @param object $cm - full cm object
*/

View File

@ -1,5 +1,11 @@
This files describes API changes for code that uses the plagiarism API.
=== 4.0 ===
* The method update_status() has been deprecated. Please use {plugin name}_before_standard_top_of_body_html() instead.
* The method get_configs() has been deprecated and will be removed from the abstract class as it was not used in core.
* The method plagiarism_get_file_results has been deprecated - it was not used in core - please call a plagiarism
plugins internal functions directly instead of using this function.
=== 3.11 ===
* Support for Essay question type in Quiz has now been implemented, allowing plagiarism plugins to display information
on the quiz overview report and when viewing an essay question response.