// 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
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
*
if ($CFG->enablecompletion) {
// Daily Completion cron.
require_once($CFG->dirroot.'/completion/cron.php');
- completion_daily_cron();
+ completion_cron_mark_started();
}
}
* 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 {
if ($CFG->enablecompletion) {
// Regular Completion cron.
require_once($CFG->dirroot.'/completion/cron.php');
- completion_regular_cron();
+ completion_cron_criteria();
+ completion_cron_completions();
}
}
} else {
return '';
}
-}
\ No newline at end of file
+}
+
+/**
+ * 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();
+}