mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'MDL-65051-master' of git://github.com/lameze/moodle
This commit is contained in:
commit
12404fa275
4 changed files with 20 additions and 36 deletions
|
@ -44,8 +44,22 @@ class plagiarism_cron_task extends scheduled_task {
|
|||
public function execute() {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->libdir.'/plagiarismlib.php');
|
||||
plagiarism_cron();
|
||||
if (!empty($CFG->enableplagiarism)) {
|
||||
require_once($CFG->libdir.'/plagiarismlib.php');
|
||||
$plagiarismplugins = plagiarism_load_available_plugins();
|
||||
foreach ($plagiarismplugins as $plugin => $dir) {
|
||||
require_once($dir . '/lib.php');
|
||||
$plagiarismclass = "plagiarism_plugin_$plugin";
|
||||
$plagiarismplugin = new $plagiarismclass;
|
||||
if (method_exists($plagiarismplugin, 'cron')) {
|
||||
mtrace('Processing cron function for plagiarism_plugin_' . $plugin . '...', '');
|
||||
cron_trace_time_and_memory();
|
||||
mtrace('It has been detected the class ' . $plagiarismclass . ' has a legacy cron method
|
||||
implemented. Plagiarism plugins should implement their own schedule tasks.', '');
|
||||
$plagiarismplugin->cron();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -160,27 +160,7 @@ function plagiarism_print_disclosure($cmid) {
|
|||
}
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* used by admin/cron.php to get similarity scores from submitted files.
|
||||
*
|
||||
*/
|
||||
function plagiarism_cron() {
|
||||
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;
|
||||
if (method_exists($plagiarismplugin, 'cron')) {
|
||||
mtrace('Processing cron function for plagiarism_plugin_' . $plugin . '...', '');
|
||||
cron_trace_time_and_memory();
|
||||
$plagiarismplugin->cron();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function - also loads lib file of plagiarism plugin
|
||||
* @return array of available plugins
|
||||
|
|
|
@ -97,17 +97,4 @@ abstract class plagiarism_plugin {
|
|||
*/
|
||||
public function update_status($course, $cm) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
This files describes API changes for code that uses the plagiarism API.
|
||||
=== 3.7 ===
|
||||
|
||||
* The plagiarism_cron() function has been deleted, plugins should implement their own scheduled tasks.
|
||||
|
||||
=== 3.4 ===
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue