Commit e93f74f4 authored by David Monllao's avatar David Monllao
Browse files

MDL-57631 enrol_ldap: Disable CLI script if task is enabled

parent 6fcdbc79
......@@ -33,6 +33,8 @@
* - For debugging & better logging, you are encouraged to use in the command line:
* -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
* @deprecated since Moodle 3.3 MDL-57631 - please do not use this CLI script any more, use scheduled task instead.
* @todo MDL-58268 This will be deleted in Moodle 3.7.
* @package enrol_ldap
* @author Iñaki Arenaza - based on code by Martin Dougiamas, Martin Langhoff and others
* @copyright 1999 onwards Martin Dougiamas {@link}
......@@ -48,6 +50,14 @@ require_once("$CFG->libdir/clilib.php");
// Ensure errors are well explained.
set_debugging(DEBUG_DEVELOPER, true);
cli_problem('[ENROL LDAP] The sync enrolments cron script has been deprecated. Please use the scheduled task instead.');
// Abort execution of the CLI script if the enrol_ldap\task\sync_enrolments is enabled.
$task = \core\task\manager::get_scheduled_task('enrol_ldap\task\sync_enrolments');
if (!$task->get_disabled()) {
cli_error('[ENROL LDAP] The scheduled task sync_enrolments is enabled, the cron execution has been aborted.');
if (!enrol_is_enabled('ldap')) {
cli_error(get_string('pluginnotenabled', 'enrol_ldap'), 2);
This files describes API changes in the enrol_ldap code.
=== 3.3 ===
* enrol/ldap/cli/sync.php script has been deprecated in favour of enrol_ldap\task\sync_enrolments task.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment