$string['tasklegacycron'] = 'Legacy cron processing for plugins';
$string['taskmessagingcleanup'] = 'Background processing for messaging';
$string['taskpasswordresetcleanup'] = 'Cleanup password reset attempts';
-$string['taskplagiarismcron'] = 'Background processing for plagiarism plugins';
+$string['taskplagiarismcron'] = 'Background processing for legacy cron in plagiarism plugins';
$string['taskportfoliocron'] = 'Background processing for portfolio plugins';
$string['taskquestioncron'] = 'Background processing for question engine';
$string['taskregistrationcron'] = 'Site registration';
}
$plagiarismplugins = plagiarism_load_available_plugins();
foreach($plagiarismplugins as $plugin => $dir) {
- mtrace('Processing cron function for plagiarism_plugin_' . $plugin . '...', '');
- cron_trace_time_and_memory();
require_once($dir.'/lib.php');
$plagiarismclass = "plagiarism_plugin_$plugin";
$plagiarismplugin = new $plagiarismclass;
- $plagiarismplugin->cron();
+ if (method_exists($plagiarismplugin, 'cron')) {
+ mtrace('Processing cron function for plagiarism_plugin_' . $plugin . '...', '');
+ cron_trace_time_and_memory();
+ $plagiarismplugin->cron();
+ }
}
}
/**
* lib.php - Contains Plagiarism base class used by plugins.
*
* @since Moodle 2.0
- * @package moodlecore
- * @subpackage plagiarism
+ * @package core_plagiarism
* @copyright 2010 Dan Marsden http://danmarsden.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
}
-//dummy class - all plugins should be based off this.
-class plagiarism_plugin {
+
+/**
+ * Plagiarism base class used by plugins.
+ *
+ * @since Moodle 2.0
+ * @package core_plagiarism
+ * @copyright 2010 Dan Marsden http://danmarsden.com
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+abstract class plagiarism_plugin {
/**
* Return the list of form element names.
*/
public function update_status($course, $cm) {
}
+
/**
- * hook for cron
+ * Deprecated cron method.
+ *
+ * This method was added by mistake in the previous versions of Moodle, do not override it since it is never called.
+ * To implement cron you need to register a scheduled task, see https://docs.moodle.org/dev/Task_API.
+ * For backward compatibility with the old cron API the method cron() from this class can also be used.
*
+ * @deprecated since Moodle 3.1 MDL-52702 - please use scheduled tasks instead.
*/
public function plagiarism_cron() {
+ debugging('plagiarism_plugin::plagiarism_cron() is deprecated. Please use scheduled tasks instead', DEBUG_DEVELOPER);
}
}
--- /dev/null
+This files describes API changes for code that uses the plagiarism API.
+
+=== 3.1 ===
+
+1) The plagiarism_plugin::plagiarism_cron() and plagiarism_plugin::cron() methods have been deprecated.
+ Plugins should now use scheduled tasks.
\ No newline at end of file