mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 20:53:53 +01:00
Merge branch 'MDL-64879-master' of git://github.com/lameze/moodle
This commit is contained in:
commit
bf32bdaff5
69
mod/assign/classes/task/cron_task.php
Normal file
69
mod/assign/classes/task/cron_task.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace mod_assign\task;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* A schedule task for assignment cron.
|
||||
*
|
||||
* @package mod_assign
|
||||
* @copyright 2019 Simey Lameze <simey@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class cron_task extends \core\task\scheduled_task {
|
||||
/**
|
||||
* Get a descriptive name for this task (shown to admins).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return get_string('crontask', 'mod_assign');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run assignment cron.
|
||||
*/
|
||||
public function execute() {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
||||
\assign::cron();
|
||||
|
||||
$plugins = \core_component::get_plugin_list('assignsubmission');
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$disabled = get_config('assignsubmission_' . $name, 'disabled');
|
||||
if (!$disabled) {
|
||||
$class = 'assign_submission_' . $name;
|
||||
require_once($CFG->dirroot . '/mod/assign/submission/' . $name . '/locallib.php');
|
||||
$class::cron();
|
||||
}
|
||||
}
|
||||
$plugins = \core_component::get_plugin_list('assignfeedback');
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$disabled = get_config('assignfeedback_' . $name, 'disabled');
|
||||
if (!$disabled) {
|
||||
$class = 'assign_feedback_' . $name;
|
||||
require_once($CFG->dirroot . '/mod/assign/feedback/' . $name . '/locallib.php');
|
||||
$class::cron();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
34
mod/assign/db/tasks.php
Normal file
34
mod/assign/db/tasks.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Definition of assignment scheduled tasks.
|
||||
*
|
||||
* @package mod_assign
|
||||
* @copyright 2019 Simey Lameze <simey@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
$tasks = array(
|
||||
array(
|
||||
'classname' => '\mod_assign\task\cron_task',
|
||||
'blocking' => 0,
|
||||
'minute' => '*',
|
||||
'hour' => '*',
|
||||
'day' => '*',
|
||||
'month' => '*',
|
||||
'dayofweek' => '*'
|
||||
)
|
||||
);
|
@ -130,6 +130,7 @@ $string['couldnotconvertsubmission'] = 'Could not convert assignment submission
|
||||
$string['couldnotcreatecoursemodule'] = 'Could not create course module.';
|
||||
$string['couldnotcreatenewassignmentinstance'] = 'Could not create new assignment instance.';
|
||||
$string['couldnotfindassignmenttoupgrade'] = 'Could not find old assignment instance to upgrade.';
|
||||
$string['crontask'] = 'Background processing for assignment module';
|
||||
$string['currentgrade'] = 'Current grade in gradebook';
|
||||
$string['currentattempt'] = 'This is attempt {$a}.';
|
||||
$string['currentattemptof'] = 'This is attempt {$a->attemptnumber} ( {$a->maxattempts} attempts allowed ).';
|
||||
|
@ -1257,39 +1257,6 @@ function assign_get_post_actions() {
|
||||
return array('upload', 'submit', 'submit for grading');
|
||||
}
|
||||
|
||||
/**
|
||||
* Call cron on the assign module.
|
||||
*/
|
||||
function assign_cron() {
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
||||
assign::cron();
|
||||
|
||||
$plugins = core_component::get_plugin_list('assignsubmission');
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$disabled = get_config('assignsubmission_' . $name, 'disabled');
|
||||
if (!$disabled) {
|
||||
$class = 'assign_submission_' . $name;
|
||||
require_once($CFG->dirroot . '/mod/assign/submission/' . $name . '/locallib.php');
|
||||
$class::cron();
|
||||
}
|
||||
}
|
||||
$plugins = core_component::get_plugin_list('assignfeedback');
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$disabled = get_config('assignfeedback_' . $name, 'disabled');
|
||||
if (!$disabled) {
|
||||
$class = 'assign_feedback_' . $name;
|
||||
require_once($CFG->dirroot . '/mod/assign/feedback/' . $name . '/locallib.php');
|
||||
$class::cron();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all other capabilities used by this module.
|
||||
* @return array Array of capability strings
|
||||
|
@ -25,6 +25,5 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->version = 2018122000; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2018122001; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2018112800; // Requires this Moodle version.
|
||||
$plugin->cron = 60;
|
||||
|
Loading…
x
Reference in New Issue
Block a user