Files
wevads-platform/debug_webservice_s3.php
2026-02-26 04:53:11 +01:00

91 lines
2.9 KiB
PHP
Executable File

<?php
// Simuler exactement l'environnement du webservice
echo "=== WEBSERVICE S3 DEBUG ===\n";
// Simuler les constantes du framework comme elles seraient dans un vrai webservice
if (!defined('DS')) {
define('DS', '/');
}
// Tenter de capturer les erreurs avec error_log
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
try {
echo "1. Testing library inclusion paths...\n";
// Test exact paths like in webservice
$libraryPaths = [
'/opt/adxapp2/app/libraries/AmazonCloud.php', // Simulate LIBRARIES_PATH . DS . 'AmazonCloud.php'
__DIR__ . '/app/libraries/AmazonCloud.php', // Relative path
dirname(dirname(__DIR__)) . '/app/libraries/AmazonCloud.php' // Absolute from root
];
$libraryFound = false;
foreach ($libraryPaths as $libraryPath) {
echo " Trying: $libraryPath - " . (file_exists($libraryPath) ? "EXISTS" : "NOT FOUND") . "\n";
if (file_exists($libraryPath)) {
require_once $libraryPath;
$libraryFound = true;
echo " ✓ Successfully included: $libraryPath\n";
break;
}
}
if (!$libraryFound) {
throw new Exception('AmazonCloud library not found in any path');
}
echo "2. Creating AmazonCloud instance...\n";
$amazonCloud = new AmazonCloud();
echo " ✓ Instance created successfully\n";
echo "3. Testing S3 connection...\n";
$testResult = $amazonCloud->testConnection();
echo "4. Connection result:\n";
echo " Success: " . ($testResult['success'] ? 'YES' : 'NO') . "\n";
echo " Message: " . $testResult['message'] . "\n";
if ($testResult['success']) {
echo " Details:\n";
foreach ($testResult['details'] as $key => $value) {
echo " $key: $value\n";
}
} else {
echo " Error details:\n";
if (isset($testResult['details'])) {
foreach ($testResult['details'] as $key => $value) {
echo " $key: $value\n";
}
}
}
echo "\n5. Simulating webservice response format...\n";
// Simuler le format de réponse du webservice
if ($testResult['success']) {
$response = [
'status' => 200,
'message' => $testResult['message'],
'data' => $testResult['details']
];
echo " Webservice would return: " . json_encode($response, JSON_PRETTY_PRINT) . "\n";
} else {
$response = [
'status' => 500,
'message' => $testResult['message'],
'data' => $testResult['details'] ?? []
];
echo " Webservice would return: " . json_encode($response, JSON_PRETTY_PRINT) . "\n";
}
} catch (Exception $e) {
echo "FATAL ERROR: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}
echo "\n=== END DEBUG ===\n";