mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-50287-master' of git://github.com/danpoltawski/moodle
This commit is contained in:
commit
ebdfde7664
@ -15,7 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Cron job for reviewing and aggregating course completion criteria
|
||||
* Code used by scheduled tasks for reviewing and aggregating course completion criteria.
|
||||
*
|
||||
* @package core_completion
|
||||
* @category completion
|
||||
@ -27,21 +27,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once($CFG->libdir.'/completionlib.php');
|
||||
|
||||
/**
|
||||
* Update user's course completion statuses
|
||||
*
|
||||
* First update all criteria completions, then aggregate all criteria completions
|
||||
* and update overall course completions
|
||||
*/
|
||||
function completion_cron() {
|
||||
|
||||
completion_cron_mark_started();
|
||||
|
||||
completion_cron_criteria();
|
||||
|
||||
completion_cron_completions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark users as started if the config option is set
|
||||
*
|
||||
|
@ -1019,7 +1019,8 @@ $string['taskcachecleanup'] = 'Remove expired cache entries';
|
||||
$string['taskcachecron'] = 'Background processing for caches';
|
||||
$string['taskcalendarcron'] = 'Send calendar notifications';
|
||||
$string['taskcheckforupdates'] = 'Check for updates';
|
||||
$string['taskcompletioncron'] = 'Calculate completion data';
|
||||
$string['taskcompletionregular'] = 'Calculate regular completion data';
|
||||
$string['taskcompletiondaily'] = 'Completion mark as started';
|
||||
$string['taskcontextcleanup'] = 'Cleanup contexts';
|
||||
$string['taskcreatecontexts'] = 'Create missing contexts';
|
||||
$string['taskdeletecachetext'] = 'Delete old text cache records';
|
||||
|
@ -24,9 +24,11 @@
|
||||
namespace core\task;
|
||||
|
||||
/**
|
||||
* Simple task to run the completion cron.
|
||||
* Simple task to run the daily completion cron.
|
||||
* @copyright 2013 onwards Martin Dougiamas http://dougiamas.com.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class completion_cron_task extends scheduled_task {
|
||||
class completion_daily_task extends scheduled_task {
|
||||
|
||||
/**
|
||||
* Get a descriptive name for this task (shown to admins).
|
||||
@ -34,7 +36,7 @@ class completion_cron_task extends scheduled_task {
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return get_string('taskcompletioncron', 'admin');
|
||||
return get_string('taskcompletiondaily', 'admin');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,9 +47,9 @@ class completion_cron_task extends scheduled_task {
|
||||
global $CFG;
|
||||
|
||||
if ($CFG->enablecompletion) {
|
||||
// Completion cron.
|
||||
// Daily Completion cron.
|
||||
require_once($CFG->dirroot.'/completion/cron.php');
|
||||
completion_cron();
|
||||
completion_cron_mark_started();
|
||||
}
|
||||
}
|
||||
|
57
lib/classes/task/completion_regular_task.php
Normal file
57
lib/classes/task/completion_regular_task.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* A scheduled task.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2015 Josh Willcock
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace core\task;
|
||||
|
||||
/**
|
||||
* Simple task to run the regular completion cron.
|
||||
* @copyright 2015 Josh Willcock
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class completion_regular_task extends scheduled_task {
|
||||
|
||||
/**
|
||||
* Get a descriptive name for this task (shown to admins).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
return get_string('taskcompletionregular', 'admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the job.
|
||||
* Throw exceptions on errors (the job will be retried).
|
||||
*/
|
||||
public function execute() {
|
||||
global $CFG;
|
||||
|
||||
if ($CFG->enablecompletion) {
|
||||
// Regular Completion cron.
|
||||
require_once($CFG->dirroot.'/completion/cron.php');
|
||||
completion_cron_criteria();
|
||||
completion_cron_completions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -159,7 +159,7 @@ $tasks = array(
|
||||
'month' => '*'
|
||||
),
|
||||
array(
|
||||
'classname' => 'core\task\completion_cron_task',
|
||||
'classname' => 'core\task\completion_regular_task',
|
||||
'blocking' => 0,
|
||||
'minute' => '*',
|
||||
'hour' => '*',
|
||||
@ -167,6 +167,15 @@ $tasks = array(
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
array(
|
||||
'classname' => 'core\task\completion_daily_task',
|
||||
'blocking' => 0,
|
||||
'minute' => 'R',
|
||||
'hour' => 'R',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
array(
|
||||
'classname' => 'core\task\portfolio_cron_task',
|
||||
'blocking' => 0,
|
||||
|
@ -2398,3 +2398,24 @@ function is_web_crawler() {
|
||||
debugging("is_web_crawler() has been deprecated, please use \\core_useragent\\is_web_crawler() instead.", DEBUG_DEVELOPER);
|
||||
return core_useragent::is_crawler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user's course completion statuses
|
||||
*
|
||||
* First update all criteria completions, then aggregate all criteria completions
|
||||
* and update overall course completions.
|
||||
*
|
||||
* @deprecated since Moodle 3.0 MDL-50287 - please do not use this function any more.
|
||||
* @todo Remove this function in Moodle 3.2 MDL-51226.
|
||||
*/
|
||||
function completion_cron() {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot.'/completion/cron.php');
|
||||
|
||||
debugging('completion_cron() is deprecated. Functionality has been moved to scheduled tasks.', DEBUG_DEVELOPER);
|
||||
completion_cron_mark_started();
|
||||
|
||||
completion_cron_criteria();
|
||||
|
||||
completion_cron_completions();
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2015090300.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2015090800.00; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user