Skip to content

Commit

Permalink
Allow cohort sync scheduled task to fail silently when auth_oidc is n…
Browse files Browse the repository at this point in the history
…ot configured
  • Loading branch information
weilai-irl committed Nov 29, 2024
1 parent 61a5699 commit b41f856
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions local/o365/classes/task/cohortsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace local_o365\task;

use core\exception\moodle_exception;
use core\task\scheduled_task;
use local_o365\feature\cohortsync\main;
use local_o365\utils;
Expand All @@ -48,8 +49,14 @@ public function get_name(): string {
* @return bool
*/
public function execute(): bool {
$graphclient = main::get_unified_api(__METHOD__);
if (empty($graphclient)) {
try {
$graphclient = main::get_unified_api(__METHOD__);
if (empty($graphclient)) {
utils::mtrace("Failed to get Graph API client. Exiting.", 1);

return true;
}
} catch (moodle_exception $e) {
utils::mtrace("Failed to get Graph API client. Exiting.", 1);

return true;
Expand Down

0 comments on commit b41f856

Please sign in to comment.