Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lbplanner/classes/enums/SETTINGS.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class SETTINGS extends Enum {
* NOTE: This is a constant! Do not set outside version.php under ANY circumstances!
*/
const V_FULLNUM = 'release_fullnum';
/**
* Key for the panic / fulloff button.
*/
const PANIC = 'panic';
/**
* Key for the setting for how many days into the future a student should be able to reserve a slot.
*/
Expand Down
4 changes: 4 additions & 0 deletions lbplanner/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

use local_lbplanner\helpers\sentry_helper;
use local_lbplanner\enums\SETTINGS;

/**
* Callback for any webservices that get called by external actors.
Expand All @@ -34,6 +35,9 @@
function local_lbplanner_override_webservice_execution(stdClass $externalfunctioninfo, array $params): mixed {
// Only override calling our own functions.
if ($externalfunctioninfo->component === 'local_lbplanner') {
if (get_config('local_lbplanner', SETTINGS::PANIC) === '1') {
throw new \moodle_exception('PANIC'); // TODO: add to translations.
}
sentry_helper::init();
// Actually calling the function (since we're overriding this part, duh).
try {
Expand Down
8 changes: 8 additions & 0 deletions lbplanner/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,12 @@
PARAM_TEXT
);
$settings->add($sentrydsnsett);

$panicsett = new admin_setting_configcheckbox(
'local_lbplanner/' . SETTINGS::PANIC,
'PANIC SWITCH',
'Turns API off - only use in emergencies. No data loss, but total loss of EduPlanner services until box is unchecked.',
'0',
);
$settings->add($panicsett);
}
Loading