mirror of
https://github.com/standardebooks/web.git
synced 2025-07-08 15:50:29 -04:00
Catch Curl error when updating projects
This commit is contained in:
parent
0490ba2951
commit
6c5caa2642
1 changed files with 16 additions and 11 deletions
|
@ -574,20 +574,25 @@ final class Project{
|
|||
return;
|
||||
}
|
||||
|
||||
$curl = curl_init($this->VcsUrl);
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, Enums\HttpMethod::Head->value); // Only perform HTTP HEAD.
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_exec($curl);
|
||||
try{
|
||||
$curl = curl_init($this->VcsUrl);
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, Enums\HttpMethod::Head->value); // Only perform HTTP HEAD.
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_exec($curl);
|
||||
|
||||
/** @var string $finalUrl */
|
||||
$finalUrl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
|
||||
/** @var string $finalUrl */
|
||||
$finalUrl = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
|
||||
|
||||
// Were we redirected?
|
||||
if($finalUrl != $this->VcsUrl){
|
||||
$this->VcsUrl = $finalUrl;
|
||||
// Were we redirected?
|
||||
if($finalUrl != $this->VcsUrl){
|
||||
$this->VcsUrl = $finalUrl;
|
||||
}
|
||||
|
||||
$this->IsVcsUrlUpdated = true;
|
||||
}
|
||||
catch(Safe\Exceptions\CurlException){
|
||||
// Probably a temporary failure, just continue but don't mark the URL as having been updated.
|
||||
}
|
||||
|
||||
$this->IsVcsUrlUpdated = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue