mirror of https://github.com/MISP/MISP
chg: [CLI] Schema diagnostic little fixes
parent
f22a10e8fc
commit
b959f1af52
|
@ -131,6 +131,9 @@ class AdminShell extends AppShell
|
|||
],
|
||||
],
|
||||
]);
|
||||
$parser->addSubcommand('schemaDiagnostics', [
|
||||
'help' => __('Check differences between current and expected database schema')
|
||||
]);
|
||||
return $parser;
|
||||
}
|
||||
|
||||
|
@ -963,8 +966,8 @@ class AdminShell extends AppShell
|
|||
public function schemaDiagnostics()
|
||||
{
|
||||
$dbSchemaDiagnostics = $this->Server->dbSchemaDiagnostic();
|
||||
$this->out('# Columns diagnostics');
|
||||
|
||||
$this->out('# Columns diagnostics');
|
||||
foreach ($dbSchemaDiagnostics['diagnostic'] as $tableName => $diagnostics) {
|
||||
$diagnostics = array_filter($diagnostics, function ($c) {
|
||||
return $c['is_critical'];
|
||||
|
@ -973,7 +976,7 @@ class AdminShell extends AppShell
|
|||
continue;
|
||||
}
|
||||
$this->out();
|
||||
$this->out('Table ' . $tableName . ':');
|
||||
$this->out("Table `$tableName`:");
|
||||
foreach ($diagnostics as $diagnostic) {
|
||||
$this->out(' - ' . $diagnostic['description']);
|
||||
$this->out(' Expected: ' . implode(' ', $diagnostic['expected']));
|
||||
|
@ -983,13 +986,15 @@ class AdminShell extends AppShell
|
|||
}
|
||||
}
|
||||
|
||||
$this->out();
|
||||
$this->out('# Index diagnostics');
|
||||
foreach ($dbSchemaDiagnostics['diagnostic_index'] as $tableName => $diagnostics) {
|
||||
if (!empty($dbSchemaDiagnostics['diagnostic_index'])) {
|
||||
$this->out();
|
||||
$this->out('Table ' . $tableName . ':');
|
||||
foreach ($diagnostics as $info) {
|
||||
$this->out(' - ' . $info['message']);
|
||||
$this->out('# Index diagnostics');
|
||||
foreach ($dbSchemaDiagnostics['diagnostic_index'] as $tableName => $diagnostics) {
|
||||
$this->out();
|
||||
$this->out('Table ' . $tableName . ':');
|
||||
foreach ($diagnostics as $info) {
|
||||
$this->out(' - ' . $info['message']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue