Skip to content

Commit

Permalink
Fix webservice token generation on Moodle 4.1 (LTS)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngandrass committed May 29, 2024
1 parent 85f580c commit 8310497
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ protected function initiate_archive_job(
string $attempts_filename_pattern,
?int $retention_seconds = null
): ?ArchiveJob {
global $USER;
global $CFG, $USER;

// Check permissions.
require_capability('mod/quiz_archiver:create', $this->context);
Expand All @@ -354,7 +354,7 @@ protected function initiate_archive_job(
}

// Create temporary webservice token
if (class_exists('core_external\util')) {
if ($CFG->branch > 401 && class_exists('core_external\util')) {
// Moodle 4.2 and above
$wstoken = core_external\util::generate_token(
EXTERNAL_TOKEN_PERMANENT,
Expand Down

0 comments on commit 8310497

Please sign in to comment.