mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
try convert once
This commit is contained in:
@ -38,8 +38,5 @@ $GLOBALS['ExtsDocument'] = array(".doc", ".docx", ".docm",
|
||||
".html", ".htm", ".mht",
|
||||
".pdf", ".djvu", ".fb2", ".epub", ".xps");
|
||||
|
||||
if ( !defined('ServiceConverterMaxTry') )
|
||||
define( 'ServiceConverterMaxTry', 3);
|
||||
|
||||
|
||||
?>
|
||||
@ -219,8 +219,6 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
|
||||
)
|
||||
);
|
||||
|
||||
$countTry = 0;
|
||||
|
||||
$opts = array('http' => array(
|
||||
'method' => 'POST',
|
||||
'timeout' => $GLOBALS['DOC_SERV_TIMEOUT'],
|
||||
@ -235,17 +233,7 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
|
||||
}
|
||||
|
||||
$context = stream_context_create($opts);
|
||||
while ($countTry < ServiceConverterMaxTry)
|
||||
{
|
||||
$countTry = $countTry + 1;
|
||||
$response_data = file_get_contents($urlToConverter, FALSE, $context);
|
||||
if ($response_data !== false) { break; }
|
||||
}
|
||||
|
||||
if ($countTry == ServiceConverterMaxTry)
|
||||
{
|
||||
throw new Exception ("Bad Request or timeout error");
|
||||
}
|
||||
$response_data = file_get_contents($urlToConverter, FALSE, $context);
|
||||
|
||||
return $response_data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user