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(settings): Adjust order of parameters for runRequest #44082

Merged
merged 1 commit into from
Mar 8, 2024
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
8 changes: 4 additions & 4 deletions apps/settings/lib/SetupChecks/CheckServerResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ protected function getTestUrls(string $url): array {

/**
* Run a HTTP request to check header
* @param string $url The relative URL to check
* @param string $method The HTTP method to use
* @param string $url The relative URL to check
* @param array{ignoreSSL?: bool, httpErrors?: bool, options?: array} $options Additional options, like
* [
* // Ignore invalid SSL certificates (e.g. self signed)
Expand All @@ -86,7 +86,7 @@ protected function getTestUrls(string $url): array {
*
* @return Generator<int, IResponse>
*/
protected function runRequest(string $url, string $method, array $options = []): Generator {
protected function runRequest(string $method, string $url, array $options = []): Generator {
$options = array_merge(['ignoreSSL' => true, 'httpErrors' => true], $options);

$client = $this->clientService->newClient();
Expand All @@ -95,7 +95,7 @@ protected function runRequest(string $url, string $method, array $options = []):

foreach ($this->getTestUrls($url) as $testURL) {
try {
yield $client->request($testURL, $method, $requestOptions);
yield $client->request($method, $testURL, $requestOptions);
} catch (\Throwable $e) {
$this->logger->debug('Can not connect to local server for running setup checks', ['exception' => $e, 'url' => $testURL]);
}
Expand All @@ -110,7 +110,7 @@ protected function runRequest(string $url, string $method, array $options = []):
* @return Generator<int, IResponse>
*/
protected function runHEAD(string $url, bool $ignoreSSL = true, bool $httpErrors = true): Generator {
return $this->runRequest($url, 'HEAD', ['ignoreSSL' => $ignoreSSL, 'httpErrors' => $httpErrors]);
return $this->runRequest('HEAD', $url, ['ignoreSSL' => $ignoreSSL, 'httpErrors' => $httpErrors]);
}

protected function getRequestOptions(bool $ignoreSSL, bool $httpErrors): array {
Expand Down
2 changes: 1 addition & 1 deletion apps/settings/lib/SetupChecks/WellKnownUrls.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function run(): SetupResult {

foreach ($urls as [$verb,$url,$validStatuses,$checkCustomHeader]) {
$works = null;
foreach ($this->runRequest($url, $verb, ['httpErrors' => false, 'options' => ['allow_redirects' => ['track_redirects' => true]]]) as $response) {
foreach ($this->runRequest($verb, $url, ['httpErrors' => false, 'options' => ['allow_redirects' => ['track_redirects' => true]]]) as $response) {
// Check that the response status matches
$works = in_array($response->getStatusCode(), $validStatuses);
// and (if needed) the custom Nextcloud header is set
Expand Down
Loading