Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only trigger pre-signed check if on tool_objectfs settings page #545

Open
wants to merge 1 commit into
base: issue519-MOODLE_310_STABLE_presigned_urls_check
Choose a base branch
from
Open
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
33 changes: 18 additions & 15 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,25 @@
new lang_string('settings:presignedurl:proxyrangerequests_help', 'tool_objectfs') . $warningtext, '1'));

// Add presigned url check to page to help with setup.
$check = new \tool_objectfs\check\presigned_urls();
$result = $check->get_result();
switch ($result->get_status()) {
case result::OK:
$notificationtype = \core\output\notification::NOTIFY_SUCCESS;
break;
case result::INFO:
$notificationtype = \core\output\notification::NOTIFY_INFO;
break;
case result::WARNING:
$notificationtype = \core\output\notification::NOTIFY_WARNING;
break;
default:
$notificationtype = \core\output\notification::NOTIFY_ERROR;
$presignedinfo = '';
if ($objectfspage) {
$check = new \tool_objectfs\check\presigned_urls();
$result = $check->get_result();
switch ($result->get_status()) {
case result::OK:
$notificationtype = \core\output\notification::NOTIFY_SUCCESS;
break;
case result::INFO:
$notificationtype = \core\output\notification::NOTIFY_INFO;
break;
case result::WARNING:
$notificationtype = \core\output\notification::NOTIFY_WARNING;
break;
default:
$notificationtype = \core\output\notification::NOTIFY_ERROR;
}
$presignedinfo = $OUTPUT->notification($result->get_summary(), $notificationtype);
}
$presignedinfo = $OUTPUT->notification($result->get_summary(), $notificationtype);

$settings->add(new admin_setting_configcheckbox('tool_objectfs/enablepresignedurls',
new lang_string('settings:presignedurl:enablepresignedurls', 'tool_objectfs'),
Expand Down