diff --git a/course/modlib.php b/course/modlib.php index 9c875e32151..434f81c89cd 100644 --- a/course/modlib.php +++ b/course/modlib.php @@ -405,10 +405,6 @@ function edit_module_post_actions($moduleinfo, $course) { } } - // To be removed (deprecated) with MDL-67526 (both lines). - require_once($CFG->libdir.'/plagiarismlib.php'); - plagiarism_save_form_elements($moduleinfo); - // Allow plugins to extend the course module form. $moduleinfo = plugin_extend_coursemodule_edit_post_actions($moduleinfo, $course); diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index 01194ab3870..16e4abe1c70 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -3187,6 +3187,27 @@ function user_get_participants($courseid, $groupid, $accesssince, $roleid, $enro return $DB->get_recordset_sql("$select $from $where $sort", $params, $limitfrom, $limitnum); } +/** + * @deprecated Since Moodle 3.9. MDL-65835 + */ +function plagiarism_save_form_elements() { + throw new coding_exception( + 'Function plagiarism_save_form_elements() has been removed. ' . + 'Please use {plugin name}_coursemodule_edit_post_actions() instead.' + ); +} + +/** + * @deprecated Since Moodle 3.9. MDL-65835 + */ +function plagiarism_get_form_elements_module() { + throw new coding_exception( + 'Function plagiarism_get_form_elements_module() has been removed. ' . + 'Please use {plugin name}_coursemodule_standard_elements() instead.' + ); +} + + /** * Returns the list of full course categories to be used in html_writer::select() * diff --git a/lib/plagiarismlib.php b/lib/plagiarismlib.php index ae89d2558ed..7f1c9f1b827 100644 --- a/lib/plagiarismlib.php +++ b/lib/plagiarismlib.php @@ -82,65 +82,6 @@ function plagiarism_get_file_results($cmid, $userid, $file) { return $allresults; } -/** - * saves/updates plagiarism settings from a modules config page - called by course/modedit.php - * - * @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_edit_post_actions() instead. - * @todo MDL-67526 This is to be moved from here to deprecatedlib.php in Moodle 4.1 - * @param object $data - form data - */ -function plagiarism_save_form_elements($data) { - global $CFG; - if (empty($CFG->enableplagiarism)) { - return ''; - } - $plagiarismplugins = plagiarism_load_available_plugins(); - foreach ($plagiarismplugins as $plugin => $dir) { - require_once($dir.'/lib.php'); - $plagiarismclass = "plagiarism_plugin_$plugin"; - $plagiarismplugin = new $plagiarismclass; - - $reflectionmethod = new ReflectionMethod($plagiarismplugin, 'save_form_elements'); - if ($reflectionmethod->getDeclaringClass()->getName() == get_class($plagiarismplugin)) { - $text = 'plagiarism_plugin::save_form_elements() is deprecated.'; - $text .= ' Use plagiarism_' . $plugin . '_coursemodule_edit_post_actions() instead'; - debugging($text, DEBUG_DEVELOPER); - } - - $plagiarismplugin->save_form_elements($data); - } -} - -/** - * adds the list of plagiarism settings to a form - called inside modules that have enabled plagiarism - * - * @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_standard_elements() instead. - * @todo MDL-67526 This is to be moved from here to deprecatedlib.php in Moodle 4.1 - * @param object $mform - Moodle form object - * @param object $context - context object - * @param string $modulename - Name of the module - */ -function plagiarism_get_form_elements_module($mform, $context, $modulename = "") { - global $CFG; - if (empty($CFG->enableplagiarism)) { - return ''; - } - $plagiarismplugins = plagiarism_load_available_plugins(); - foreach ($plagiarismplugins as $plugin => $dir) { - require_once($dir.'/lib.php'); - $plagiarismclass = "plagiarism_plugin_$plugin"; - $plagiarismplugin = new $plagiarismclass; - - $reflectionmethod = new ReflectionMethod($plagiarismplugin, 'get_form_elements_module'); - if ($reflectionmethod->getDeclaringClass()->getName() == get_class($plagiarismplugin)) { - $text = 'plagiarism_plugin::get_form_elements_module() is deprecated.'; - $text .= ' Use plagiarism_' . $plugin . '_coursemodule_standard_elements() instead'; - debugging($text, DEBUG_DEVELOPER); - } - - $plagiarismplugin->get_form_elements_module($mform, $context, $modulename); - } -} /** * Allows a plagiarism plugin to print a button/link at the top of activity overview report pages. * @@ -197,12 +138,10 @@ function plagiarism_print_disclosure($cmid) { /** * Helper function - also loads lib file of plagiarism plugin * - * @todo MDL-67872 the deprecated code in this function to be removed in Moodle 4.1 * @return array of available plugins */ function plagiarism_load_available_plugins() { global $CFG; - static $showndeprecatedmessage = array(); // Only show message once per page load. if (empty($CFG->enableplagiarism)) { return array(); @@ -211,18 +150,7 @@ function plagiarism_load_available_plugins() { $availableplugins = array(); foreach ($plagiarismplugins as $plugin => $dir) { // Check this plugin is enabled and a lib file exists. - if (get_config('plagiarism', $plugin."_use")) { - // Deprecated Since Moodle 3.9. - $pluginenabled = true; - if (empty($showndeprecatedmessage[$plugin])) { - $text = 'The setting plagiarism:'.$plugin.'_use is deprecated.'; - $text .= ' Use plagiarism_' . $plugin . ':enabled instead'; - debugging($text, DEBUG_DEVELOPER); - $showndeprecatedmessage[$plugin] = true; - } - } else { - $pluginenabled = get_config('plagiarism_'.$plugin, 'enabled'); - } + $pluginenabled = get_config('plagiarism_'.$plugin, 'enabled'); if ($pluginenabled && file_exists($dir."/lib.php")) { require_once($dir.'/lib.php'); $plagiarismclass = "plagiarism_plugin_$plugin"; diff --git a/mod/assign/mod_form.php b/mod/assign/mod_form.php index 64fdde4b2fd..6af5c1c777d 100644 --- a/mod/assign/mod_form.php +++ b/mod/assign/mod_form.php @@ -202,12 +202,6 @@ class mod_assign_mod_form extends moodleform_mod { $mform->addElement('selectyesno', 'sendstudentnotifications', $name); $mform->addHelpButton('sendstudentnotifications', 'sendstudentnotificationsdefault', 'assign'); - // Plagiarism enabling form. To be removed (deprecated) with MDL-67526. - if (!empty($CFG->enableplagiarism)) { - require_once($CFG->libdir . '/plagiarismlib.php'); - plagiarism_get_form_elements_module($mform, $ctx->get_course_context(), 'mod_assign'); - } - $this->standard_grading_coursemodule_elements(); $name = get_string('blindmarking', 'assign'); $mform->addElement('selectyesno', 'blindmarking', $name); diff --git a/mod/forum/mod_form.php b/mod/forum/mod_form.php index 37174841848..d1b194e2980 100644 --- a/mod/forum/mod_form.php +++ b/mod/forum/mod_form.php @@ -205,10 +205,6 @@ class mod_forum_mod_form extends moodleform_mod { $mform->addHelpButton('warnafter', 'warnafter', 'forum'); $mform->hideIf('warnafter', 'blockperiod', 'eq', 0); - $coursecontext = context_course::instance($COURSE->id); - // To be removed (deprecated) with MDL-67526. - plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_forum'); - //------------------------------------------------------------------------------- // Add the whole forum grading options. diff --git a/mod/workshop/mod_form.php b/mod/workshop/mod_form.php index f693a2bdd14..f0ecddd6702 100644 --- a/mod/workshop/mod_form.php +++ b/mod/workshop/mod_form.php @@ -247,10 +247,6 @@ class mod_workshop_mod_form extends moodleform_mod { $label = get_string('assessmentend', 'workshop'); $mform->addElement('date_time_selector', 'assessmentend', $label, array('optional' => true)); - $coursecontext = context_course::instance($this->course->id); - // To be removed (deprecated) with MDL-67526. - plagiarism_get_form_elements_module($mform, $coursecontext, 'mod_workshop'); - // Common module settings, Restrict availability, Activity completion etc. ---- $features = array('groups' => true, 'groupings' => true, 'outcomes' => true, 'gradecat' => false, 'idnumber' => false); diff --git a/plagiarism/lib.php b/plagiarism/lib.php index bc444cc7c71..75753051759 100644 --- a/plagiarism/lib.php +++ b/plagiarism/lib.php @@ -72,24 +72,6 @@ abstract class plagiarism_plugin { public function get_file_results($cmid, $userid, $file) { return array('analyzed' => '', 'score' => '', 'reporturl' => ''); } - /** - * hook to add plagiarism specific settings to a module settings page - * @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_edit_post_actions() instead. - * @todo MDL-67526 Remove this method. - * @param object $mform - Moodle form - * @param object $context - current context - * @param string $modulename - Name of the module - */ - public function get_form_elements_module($mform, $context, $modulename = "") { - } - /** - * hook to save plagiarism specific settings on a module settings page - * @deprecated Since Moodle 3.9. MDL-65835 Please use {plugin name}_coursemodule_standard_elements() instead. - * @todo MDL-67526 Remove this method. - * @param object $data - data from an mform submission. - */ - public function save_form_elements($data) { - } /** * hook to allow a disclosure to be printed notifying users what will happen with their submission * @param int $cmid - course module id diff --git a/plagiarism/upgrade.txt b/plagiarism/upgrade.txt index e871f36ddf6..0400957f84b 100644 --- a/plagiarism/upgrade.txt +++ b/plagiarism/upgrade.txt @@ -1,5 +1,12 @@ This files describes API changes for code that uses the plagiarism API. +=== 4.2 === +* Final deprecation and removal of the following functions: + - plagiarism_save_form_elements(), please use {plugin name}_coursemodule_edit_post_actions() instead. + - plagiarism_get_form_elements_module(), please use {plugin name}_coursemodule_standard_elements() instead. + - plagiarism_plugin::get_form_elements_module(), please use {plugin name}_coursemodule_edit_post_actions() instead. + - plagiarism_plugin::save_form_elements(), please use {plugin name}_coursemodule_standard_elements() instead. + === 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.