Merge branch 'MDL-71326-final-deprecation-of-plagiarism-functions-4-4' of https://github.com/ziegenberg/moodle

This commit is contained in:
Huong Nguyen 2024-08-29 10:13:56 +07:00
commit 490556705c
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A
6 changed files with 41 additions and 105 deletions

View File

@ -0,0 +1,14 @@
issueNumber: MDL-71326
notes:
core:
- message: >+
- Final deprecation and removal of the following functions:
- `plagiarism_plugin::get_configs()`
- `plagiarism_plugin::get_file_results()`
- `plagiarism_plugin::update_status()`, please use `{plugin name}_before_standard_top_of_body_html` instead.
- Final deprecation and removal of `plagiarism_get_file_results()`.
Please use `plagiarism_get_links()` instead.
- Final deprecation and removal of `plagiarism_update_status()`. Please
use `{plugin name}_before_standard_top_of_body_html()` instead.
type: deprecated

View File

@ -759,3 +759,29 @@ function reset_password_and_mail($user) {
// Directly email rather than using the messaging system to ensure its not routed to a popup or jabber.
return email_to_user($user, $supportuser, $subject, $message);
}
/**
* @deprecated Since Moodle 4.0 MDL-71175. Please use plagiarism_get_links() or plugin specific functions..
*/
#[\core\attribute\deprecated(
replacement: 'plagiarism_get_links',
since: '4.0',
mdl: 'MDL-71175',
final: true,
)]
function plagiarism_get_file_results(): void {
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
}
/**
* @deprecated Since Moodle 4.0 - Please use {plugin name}_before_standard_top_of_body_html instead.
*/
#[\core\attribute\deprecated(
replacement: '{plugin name}_before_standard_top_of_body_html',
since: '4.0',
mdl: 'MDL-71175',
final: true,
)]
function plagiarism_update_status(): void {
\core\deprecation::emit_deprecation_if_present(__FUNCTION__);
}

View File

@ -53,67 +53,6 @@ function plagiarism_get_links($linkarray) {
return '';
}
/**
* 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
* @return array - sets of details about specified file, one array of details per plagiarism plugin
* - each set contains at least 'analyzed', 'score', 'reporturl'
*/
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;
}
$plagiarismplugins = plagiarism_load_available_plugins();
foreach ($plagiarismplugins as $plugin => $dir) {
require_once($dir.'/lib.php');
$plagiarismclass = "plagiarism_plugin_$plugin";
$plagiarismplugin = new $plagiarismclass;
$allresults[] = $plagiarismplugin->get_file_results($cmid, $userid, $file);
}
return $allresults;
}
/**
* 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
*/
function plagiarism_update_status($course, $cm) {
global $CFG;
if (empty($CFG->enableplagiarism)) {
return '';
}
$plagiarismplugins = plagiarism_load_available_plugins();
$output = '';
foreach ($plagiarismplugins as $plugin => $dir) {
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;
}
/**
* Function that prints the student disclosure notifying that the files will be checked for plagiarism
* @param integer $cmid - the cmid of this module

View File

@ -4603,12 +4603,6 @@ class assign {
$o .= $actionformtext;
// Plagiarism update status apearring in the grading book.
if (!empty($CFG->enableplagiarism)) {
require_once($CFG->libdir . '/plagiarismlib.php');
$o .= plagiarism_update_status($this->get_course(), $this->get_course_module());
}
if ($this->is_blind_marking() && has_capability('mod/assign:viewblinddetails', $this->get_context())) {
$o .= $this->get_renderer()->notification(get_string('blindmarkingenabledwarning', 'assign'), 'notifymessage');
}

View File

@ -68,10 +68,6 @@ abstract class report_base {
if (!$PAGE->has_secondary_navigation()) {
echo $OUTPUT->heading(format_string($quiz->name, true, ['context' => $context]));
}
if (!empty($CFG->enableplagiarism)) {
require_once($CFG->libdir . '/plagiarismlib.php');
echo plagiarism_update_status($course, $cm);
}
}
/**

View File

@ -39,16 +39,6 @@ if (!defined('MOODLE_INTERNAL')) {
*/
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() {
return array();
}
/**
* hook to allow plagiarism specific information to be displayed beside a submission
* @param array $linkarraycontains all relevant information for the plugin to generate a link
@ -57,21 +47,7 @@ abstract class plagiarism_plugin {
public function get_links($linkarray) {
return '';
}
/**
* 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
* @return array containing at least:
* - 'analyzed' - whether the file has been successfully analyzed
* - 'score' - similarity score - ('' if not known)
* - 'reporturl' - url of originality report - '' if unavailable
*/
public function get_file_results($cmid, $userid, $file) {
return array('analyzed' => '', 'score' => '', 'reporturl' => '');
}
/**
* hook to allow a disclosure to be printed notifying users what will happen with their submission
* @param int $cmid - course module id
@ -79,13 +55,4 @@ abstract class plagiarism_plugin {
*/
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
*/
public function update_status($course, $cm) {
}
}