mirror of
https://github.com/kleeja-official/kleeja.git
synced 2025-12-15 20:49:41 +01:00
Update FetchFile.php
This commit is contained in:
@@ -124,29 +124,31 @@ class FetchFile
|
||||
$out = fopen($this->destinationPath, 'w');
|
||||
curl_setopt($ch, CURLOPT_FILE, $out);
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
fclose($out);
|
||||
|
||||
if ($result === false)
|
||||
{
|
||||
$error = true;
|
||||
kleeja_log(sprintf("cUrl error (#%d): %s\n", curl_errno($ch), htmlspecialchars(curl_error($ch))));
|
||||
return false;
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
fclose($out);
|
||||
|
||||
return true;
|
||||
return isset($error) ? false : true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
if ($data === false)
|
||||
{
|
||||
$error = true;
|
||||
kleeja_log(sprintf("FetchFile error (curl: #%d): %s\n", curl_errno($ch), htmlspecialchars(curl_error($ch))));
|
||||
return false;
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
return $data;
|
||||
return isset($error) ? false : $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user