$s !== ''); echo "== " . basename($file) . " (" . count($statements) . " statement) ==\n"; foreach ($statements as $stmt) { try { $pdo->exec($stmt); $totalStmts++; } catch (PDOException $e) { $head = substr(preg_replace('/\s+/', ' ', $stmt), 0, 80); fwrite(STDERR, "[ERRORE] su \"$head...\": " . $e->getMessage() . "\n"); exit(1); } } } // Verifica rapida del seed. $count = (int) ($pdo->query('SELECT COUNT(*) AS n FROM iso27001_annex_controls')->fetch()['n'] ?? 0); $byStd = $pdo->query('SELECT standard, COUNT(*) AS n FROM iso27001_annex_controls GROUP BY standard')->fetchAll(); echo "\n[OK] Eseguiti $totalStmts statement.\n"; echo "[OK] iso27001_annex_controls: $count controlli totali.\n"; foreach ($byStd as $r) { echo " - {$r['standard']}: {$r['n']}\n"; } echo "[OK] Tabelle SGSI pronte (isms_models, isms_roles, isms_soa, isms_documents).\n";