mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-52702 plagiarism: Improvements to base plugin class
This commit is contained in:
parent
e65dfd9f28
commit
5e43eea080
@ -1032,7 +1032,7 @@ $string['taskgradecron'] = 'Background processing for gradebook';
|
||||
$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';
|
||||
|
@ -171,12 +171,14 @@ function plagiarism_cron() {
|
||||
}
|
||||
$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();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -19,8 +19,7 @@
|
||||
* 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
|
||||
*/
|
||||
@ -29,8 +28,16 @@ if (!defined('MOODLE_INTERNAL')) {
|
||||
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.
|
||||
@ -90,10 +97,17 @@ class plagiarism_plugin {
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
6
plagiarism/upgrade.txt
Normal file
6
plagiarism/upgrade.txt
Normal file
@ -0,0 +1,6 @@
|
||||
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.
|
Loading…
x
Reference in New Issue
Block a user