mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +02:00
Issue #47 - CLI will fail if outage plugin is not enabled.
This commit is contained in:
@@ -64,6 +64,11 @@ class cli_exception extends Exception {
|
||||
*/
|
||||
const ERROR_OUTAGE_CHANGED = 7;
|
||||
|
||||
/**
|
||||
* The outage plugin is not enabled.
|
||||
*/
|
||||
const ERROR_PLUGIN_DISABLED = 8;
|
||||
|
||||
/**
|
||||
* cliexception constructor.
|
||||
* @param string $message An explanation of the exception.
|
||||
|
||||
@@ -20,6 +20,7 @@ use coding_exception;
|
||||
use core\session\manager;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
/**
|
||||
* Outage CLI base class.
|
||||
@@ -47,7 +48,9 @@ abstract class clibase {
|
||||
*/
|
||||
public function __construct(array $options = null) {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
if (!is_enabled_auth('outage')) {
|
||||
throw new cli_exception(get_string('cliplugindisabled', 'auth_outage'), cli_exception::ERROR_PLUGIN_DISABLED);
|
||||
}
|
||||
|
||||
$this->become_admin_user();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user