diff --git a/.upgradenotes/MDL-71326-2024082121203527.yml b/.upgradenotes/MDL-71326-2024082121203527.yml new file mode 100644 index 00000000000..cc3ee58506c --- /dev/null +++ b/.upgradenotes/MDL-71326-2024082121203527.yml @@ -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 diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 6827c070073..8a6eaf02d2a 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -751,3 +751,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__); +} diff --git a/lib/plagiarismlib.php b/lib/plagiarismlib.php index 7f1c9f1b827..b2d478b9102 100644 --- a/lib/plagiarismlib.php +++ b/lib/plagiarismlib.php @@ -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 diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index ec9d2e2ed53..e45cdedfbc2 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4598,12 +4598,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'); } diff --git a/mod/quiz/classes/local/reports/report_base.php b/mod/quiz/classes/local/reports/report_base.php index edfac16b31a..6337feb0def 100644 --- a/mod/quiz/classes/local/reports/report_base.php +++ b/mod/quiz/classes/local/reports/report_base.php @@ -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); - } } /** diff --git a/plagiarism/lib.php b/plagiarism/lib.php index 75753051759..3564db17eaf 100644 --- a/plagiarism/lib.php +++ b/plagiarism/lib.php @@ -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) { - } }