MDL-50287 completion: avoid introducing uncessary functions

Also fix copyright
This commit is contained in:
Dan Poltawski 2015-08-27 14:33:10 +01:00
parent 51e488eaf3
commit 0628925bf1
4 changed files with 28 additions and 39 deletions

View File

@ -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,39 +27,6 @@
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/completionlib.php');
/**
* Legacy - here for plugin use only, not used in scheduled tasks.
* 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();
}
/**
* Update user's course completion statuses
*
* First update all criteria completions, then aggregate all criteria completions
* and update overall course completions
*/
function completion_regular_cron() {
// Two Functions which check criteria and learner completions regularly for accurate data.
completion_cron_criteria();
completion_cron_completions();
}
/**
* Marks users as started if the config option is set.
*
* One function which takes a long time 60+ minutes to enrol users onto completion started.
*/
function completion_daily_cron() {
completion_cron_mark_started();
}
/**
* Mark users as started if the config option is set
*

View File

@ -49,7 +49,7 @@ class completion_cron_daily_task extends scheduled_task {
if ($CFG->enablecompletion) {
// Daily Completion cron.
require_once($CFG->dirroot.'/completion/cron.php');
completion_daily_cron();
completion_cron_mark_started();
}
}

View File

@ -18,14 +18,14 @@
* A scheduled task.
*
* @package core
* @copyright 2013 onwards Martin Dougiamas http://dougiamas.com
* @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 2013 onwards Martin Dougiamas http://dougiamas.com.
* @copyright 2015 Josh Willcock
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
class completion_cron_regular_task extends scheduled_task {
@ -49,7 +49,8 @@ class completion_cron_regular_task extends scheduled_task {
if ($CFG->enablecompletion) {
// Regular Completion cron.
require_once($CFG->dirroot.'/completion/cron.php');
completion_regular_cron();
completion_cron_criteria();
completion_cron_completions();
}
}

View File

@ -2378,4 +2378,25 @@ function get_referer($stripquery = true) {
} else {
return '';
}
}
}
/**
* 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();
}