WebP Express CloudHost.es Fix v0.25.9-cloudhost

 Fixed bulk conversion getting stuck on missing files
 Added robust error handling and timeout protection
 Improved JavaScript response parsing
 Added file existence validation
 Fixed missing PHP class imports
 Added comprehensive try-catch error recovery

🔧 Key fixes:
- File existence checks before conversion attempts
- 30-second timeout protection per file
- Graceful handling of 500 errors and JSON parsing issues
- Automatic continuation to next file on failures
- Cache busting for JavaScript updates

🎯 Result: Bulk conversion now completes successfully even with missing files

🚀 Generated with Claude Code (https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-23 10:22:32 +02:00
commit 37cf714058
553 changed files with 55249 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<?php
namespace WebPConvert\Convert\Converters\ConverterTraits;
use WebPConvert\Convert\Exceptions\ConversionFailed\ConverterNotOperational\SystemRequirementsNotMetException;
use WebPConvert\Convert\Converters\AbstractConverter;
/**
* Trait for converters that works by uploading to a cloud service.
*
* The trait adds a method for checking against upload limits.
*
* @package WebPConvert
* @author Bjørn Rosell <it@rosell.dk>
* @since Class available since Release 2.0.0
*/
trait CurlTrait
{
/**
* Check basis operationality for converters relying on curl.
*
* Performs the same as ::checkOperationality(). It is here so converters that overrides the
* ::checkOperationality() still has a chance to do the checks.
*
* @throws SystemRequirementsNotMetException
* @return void
*/
public function checkOperationalityForCurlTrait()
{
if (!extension_loaded('curl')) {
throw new SystemRequirementsNotMetException('Required cURL extension is not available.');
}
if (!function_exists('curl_init')) {
throw new SystemRequirementsNotMetException('Required url_init() function is not available.');
}
if (!function_exists('curl_file_create')) {
throw new SystemRequirementsNotMetException(
'Required curl_file_create() function is not available (requires PHP > 5.5).'
);
}
}
/**
* Check basis operationality for converters relying on curl
*
* @throws SystemRequirementsNotMetException
* @return void
*/
public function checkOperationality()
{
$this->checkOperationalityForCurlTrait();
}
/**
* Init curl.
*
* @throws SystemRequirementsNotMetException if curl could not be initialized
* @return resource|\CurlHandle curl handle (from PHP8: CurlHandle)
*/
protected static function initCurl()
{
// Get curl handle
$ch = \curl_init();
if ($ch === false) {
throw new SystemRequirementsNotMetException('Could not initialise cURL.');
}
return $ch;
}
}