57 lines
1.6 KiB
PHP
Executable File
57 lines
1.6 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Script de test AWS S3 pour diagnostiquer les problèmes de permissions
|
|
*/
|
|
|
|
// Include the AWS SDK
|
|
require_once '/opt/adxapp2/app/libraries/AmazonCloud.php';
|
|
|
|
echo "=== Test de diagnostic AWS S3 ===\n\n";
|
|
|
|
// Lire la configuration
|
|
$configFile = '/opt/adxapp2/app/config/amazoncloud.crd.json';
|
|
if (!file_exists($configFile)) {
|
|
echo "ERREUR: Fichier de configuration non trouvé : $configFile\n";
|
|
exit(1);
|
|
}
|
|
|
|
$config = json_decode(file_get_contents($configFile), true);
|
|
if (!$config) {
|
|
echo "ERREUR: Impossible de lire la configuration JSON\n";
|
|
exit(1);
|
|
}
|
|
|
|
echo "Configuration chargée :\n";
|
|
echo "- Région: " . $config['region'] . "\n";
|
|
echo "- Bucket: " . $config['BucketName'] . "\n";
|
|
echo "- Access Key ID: " . substr($config['AWSAccessKeyId'], 0, 8) . "...\n\n";
|
|
|
|
try {
|
|
// Créer une instance d'AmazonCloud
|
|
$amazonCloud = new AmazonCloud();
|
|
|
|
echo "1. Test de création du client S3...\n";
|
|
|
|
// Tester la connexion
|
|
echo "2. Test de connexion S3...\n";
|
|
$testResult = $amazonCloud->testConnection();
|
|
|
|
if ($testResult['success']) {
|
|
echo "✓ SUCCÈS: " . $testResult['message'] . "\n";
|
|
if (isset($testResult['details'])) {
|
|
echo "Détails: " . print_r($testResult['details'], true) . "\n";
|
|
}
|
|
} else {
|
|
echo "✗ ÉCHEC: " . $testResult['message'] . "\n";
|
|
if (isset($testResult['details'])) {
|
|
echo "Détails: " . print_r($testResult['details'], true) . "\n";
|
|
}
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "✗ EXCEPTION: " . $e->getMessage() . "\n";
|
|
echo "Trace: " . $e->getTraceAsString() . "\n";
|
|
}
|
|
|
|
echo "\n=== Fin du test ===\n";
|
|
?>
|