1
0
Fork 0

Ensure diagnose command works even if provider-includes disappears

pull/11943/head
Jordi Boggiano 2024-04-19 14:20:56 +02:00
parent 41fb6146b0
commit 3604996464
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 8 additions and 6 deletions

View File

@ -328,6 +328,7 @@ EOT
} }
$json = $this->httpDownloader->get($protocol.'://repo.packagist.org/packages.json')->decodeJson(); $json = $this->httpDownloader->get($protocol.'://repo.packagist.org/packages.json')->decodeJson();
if (isset($json['provider-includes'])) {
$hash = reset($json['provider-includes']); $hash = reset($json['provider-includes']);
$hash = $hash['sha256']; $hash = $hash['sha256'];
$path = str_replace('%hash%', $hash, key($json['provider-includes'])); $path = str_replace('%hash%', $hash, key($json['provider-includes']));
@ -336,6 +337,7 @@ EOT
if (hash('sha256', $provider) !== $hash) { if (hash('sha256', $provider) !== $hash) {
return '<warning>It seems that your proxy ('.$proxyStatus.') is modifying '.$protocol.' traffic on the fly</>'; return '<warning>It seems that your proxy ('.$proxyStatus.') is modifying '.$protocol.' traffic on the fly</>';
} }
}
return '<info>OK</> <comment>'.$proxyStatus.'</>'; return '<info>OK</> <comment>'.$proxyStatus.'</>';
} catch (\Exception $e) { } catch (\Exception $e) {