From 78be6db43fb27ef8308d70271fddda60ae157a8f Mon Sep 17 00:00:00 2001 From: Matthew Hilton Date: Mon, 15 Jan 2024 11:43:55 +1000 Subject: [PATCH] Some tweaks --- classes/local/store/s3/client.php | 4 ++-- settings.php | 21 --------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/classes/local/store/s3/client.php b/classes/local/store/s3/client.php index 60e295e3..2cbec0c8 100644 --- a/classes/local/store/s3/client.php +++ b/classes/local/store/s3/client.php @@ -299,7 +299,7 @@ public function test_connection(): result { $details = $this->get_exception_details($e); } - $summarystr = result::OK ? 'check:passed' : 'check:failed'; + $summarystr = $status == result::OK ? 'check:passed' : 'check:failed'; $summary = get_string($summarystr, 'tool_objectfs'); return new result($status, $summary, $details); } @@ -368,7 +368,7 @@ public function test_permissions($testdelete): result { } } - $summarystr = result::OK ? 'settings:permissioncheckpassed' : 'settings:permissioncheckfailed'; + $summarystr = $status == result::OK ? 'settings:permissioncheckpassed' : 'settings:permissioncheckfailed'; $summary = get_string($summarystr, 'tool_objectfs'); return new result($status, $summary, $details); } diff --git a/settings.php b/settings.php index a941e506..98829582 100644 --- a/settings.php +++ b/settings.php @@ -158,27 +158,6 @@ new lang_string('settings:presignedurl:header', 'tool_objectfs'), $warningtext)); if ($classexists) { - $connstatus = false; - if ($objectfspage) { - $testconn = $client->test_connection(); - $connstatus = $testconn->success; - } - - $warningtext = ''; - $methodexists = method_exists('file_system', 'xsendfile_file'); - if (!$methodexists) { - $warningtext .= $OUTPUT->notification(get_string('settings:presignedurl:xsendfilefile', 'tool_objectfs')); - } else if ($connstatus) { - // Range request tests can only work if there is a valid connection. - $range = $client->test_range_request(new $config->filesystem()); - if ($range->result) { - $warningtext .= $OUTPUT->notification(get_string('settings:presignedurl:testrangeok', 'tool_objectfs'), - 'notifysuccess'); - } else { - $warningtext .= $OUTPUT->notification(get_string('settings:presignedurl:testrangeerror', 'tool_objectfs')); - $warningtext .= $OUTPUT->notification($range->error); - } - } $settings->add(new admin_setting_configcheckbox('tool_objectfs/proxyrangerequests', new lang_string('settings:presignedurl:proxyrangerequests', 'tool_objectfs'), new lang_string('settings:presignedurl:proxyrangerequests_help', 'tool_objectfs') . $warningtext, '1'));