Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 31 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| DiagnosticController | |
0.00% |
0 / 31 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| index | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| health | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| connectivity | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| export | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Modules\SupportModule\Controllers; |
| 4 | |
| 5 | use App\Controllers\BaseController; |
| 6 | use App\Modules\SupportModule\Services\DiagnosticCollectorService; |
| 7 | use CodeIgniter\HTTP\ResponseInterface; |
| 8 | |
| 9 | class DiagnosticController extends BaseController |
| 10 | { |
| 11 | protected DiagnosticCollectorService $diagnosticService; |
| 12 | |
| 13 | public function __construct() |
| 14 | { |
| 15 | $this->diagnosticService = service('diagnosticCollector'); |
| 16 | } |
| 17 | |
| 18 | /** |
| 19 | * Diagnostic global de l'application (état système complet) |
| 20 | */ |
| 21 | public function index(): ResponseInterface |
| 22 | { |
| 23 | $tenant = session()->get('tenant'); |
| 24 | |
| 25 | $report = $this->diagnosticService->collect([ |
| 26 | 'tenant' => $tenant, |
| 27 | 'mode' => 'full' |
| 28 | ]); |
| 29 | |
| 30 | return $this->response->setJSON([ |
| 31 | 'status' => 'ok', |
| 32 | 'diagnostic' => $report |
| 33 | ]); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Health-check léger |
| 38 | */ |
| 39 | public function health(): ResponseInterface |
| 40 | { |
| 41 | $report = $this->diagnosticService->collect([ |
| 42 | 'mode' => 'light' |
| 43 | ]); |
| 44 | |
| 45 | return $this->response->setJSON([ |
| 46 | 'status' => 'ok', |
| 47 | 'health' => $report |
| 48 | ]); |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Test de connectivité services externes |
| 53 | */ |
| 54 | public function connectivity(): ResponseInterface |
| 55 | { |
| 56 | $result = $this->diagnosticService->testConnectivity(); |
| 57 | |
| 58 | return $this->response->setJSON([ |
| 59 | 'status' => 'ok', |
| 60 | 'connectivity' => $result |
| 61 | ]); |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Export diagnostic pour support technique |
| 66 | */ |
| 67 | public function export(): ResponseInterface |
| 68 | { |
| 69 | $report = $this->diagnosticService->collect([ |
| 70 | 'mode' => 'full', |
| 71 | 'include_sensitive' => false, |
| 72 | 'tenant' => session()->get('tenant') |
| 73 | ]); |
| 74 | |
| 75 | return $this->response->setJSON([ |
| 76 | 'status' => 'ok', |
| 77 | 'export' => $report |
| 78 | ]); |
| 79 | } |
| 80 | } |