Skip to content

Commit

Permalink
MDL-71175 plagiarism: Deprecate some old functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarsden committed Jun 25, 2021
1 parent a747fd3 commit 4b18cc0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions lib/plagiarismlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions plagiarism/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -58,6 +59,8 @@ public function get_links($linkarray) {
}
/**
* 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
Expand Down Expand Up @@ -96,7 +99,8 @@ public function print_disclosure($cmid) {
}
/**
* 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
*/
Expand Down
6 changes: 6 additions & 0 deletions plagiarism/upgrade.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 4b18cc0

Please sign in to comment.