mirror of https://github.com/MISP/MISP
chg: [diagnostic:DBIndexes] Cleanup, bug fix and updated db_schema
parent
637e2806ef
commit
7be275aced
|
@ -524,7 +524,7 @@ class AdminShell extends AppShell
|
|||
$dbVersion = $dbVersion['AdminSetting']['value'];
|
||||
$data = array(
|
||||
'schema' => $dbActualSchema['schema'],
|
||||
'indexes' => $dbActualSchema['indexes']
|
||||
'indexes' => $dbActualSchema['indexes'],
|
||||
'db_version' => $dbVersion
|
||||
);
|
||||
$file = new File(ROOT . DS . 'db_schema.json', true);
|
||||
|
|
|
@ -4640,14 +4640,6 @@ class Server extends AppModel
|
|||
|
||||
public function compareDBIndexes($actualIndex, $expectedIndex)
|
||||
{
|
||||
$expectedIndex = $actualIndex;
|
||||
unset($actualIndex['decaying_models']);
|
||||
unset($actualIndex['feeds'][0]);
|
||||
unset($actualIndex['feeds'][1]);
|
||||
unset($actualIndex['galaxy_reference'][0]);
|
||||
unset($actualIndex['galaxy_reference'][3]);
|
||||
unset($actualIndex['notification_logs'][1]);
|
||||
unset($expectedIndex['threads'][2]);
|
||||
$indexDiff = array();
|
||||
foreach($expectedIndex as $tableName => $indexes) {
|
||||
if (!array_key_exists($tableName, $actualIndex)) {
|
||||
|
|
|
@ -9,44 +9,48 @@
|
|||
<strong><?php echo __('Notice'); ?></strong>
|
||||
<?php echo __('The highlighted issues may be benign. if you are unsure, please open an issue and ask for clarification.'); ?>
|
||||
</div>
|
||||
<table id="tableDBIndexes" class="table table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table name</th>
|
||||
<th>Column name</th>
|
||||
<th>Indexed</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($columnPerTable as $tableName => $columnArray): ?>
|
||||
<?php
|
||||
$columnCount = 0;
|
||||
$rowHtml = '';
|
||||
?>
|
||||
<?php foreach($columnArray as $columnName): ?>
|
||||
<?php if(empty($diagnostic)): ?>
|
||||
<span class="label label-success"><?php echo __('Index diagnostic:'); ?><i class="fa fa-check"></i></span>
|
||||
<?php else: ?>
|
||||
<table id="tableDBIndexes" class="table table-condensed table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Table name</th>
|
||||
<th>Column name</th>
|
||||
<th>Indexed</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($columnPerTable as $tableName => $columnArray): ?>
|
||||
<?php
|
||||
$columnIndexed = !empty($indexes[$tableName]) && in_array($columnName, $indexes[$tableName]);
|
||||
$warning = isset($diagnostic[$tableName][$columnName]);
|
||||
if ($warning) {
|
||||
$columnCount++;
|
||||
}
|
||||
$rowHtml .= sprintf('%s%s%s%s%s',
|
||||
sprintf('<tr class="%s">', $warning ? 'error' : 'indexInfo hidden'),
|
||||
sprintf('<td>%s</td>', h($columnName)),
|
||||
sprintf('<td><i class="bold fa %s"></i></td>', $columnIndexed ? 'green fa-check' : 'red fa-times'),
|
||||
sprintf('<td>%s</td>', $warning ? h($diagnostic[$tableName][$columnName]) : ''),
|
||||
'</tr>'
|
||||
);
|
||||
$columnCount = 0;
|
||||
$rowHtml = '';
|
||||
?>
|
||||
<?php foreach($columnArray as $columnName): ?>
|
||||
<?php
|
||||
$columnIndexed = !empty($indexes[$tableName]) && in_array($columnName, $indexes[$tableName]);
|
||||
$warning = isset($diagnostic[$tableName][$columnName]);
|
||||
if ($warning) {
|
||||
$columnCount++;
|
||||
}
|
||||
$rowHtml .= sprintf('%s%s%s%s%s',
|
||||
sprintf('<tr class="%s">', $warning ? 'error' : 'indexInfo hidden'),
|
||||
sprintf('<td>%s</td>', h($columnName)),
|
||||
sprintf('<td><i class="bold fa %s"></i></td>', $columnIndexed ? 'green fa-check' : 'red fa-times'),
|
||||
sprintf('<td>%s</td>', $warning ? h($diagnostic[$tableName][$columnName]) : ''),
|
||||
'</tr>'
|
||||
);
|
||||
?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($columnCount > 0): ?>
|
||||
<?php echo sprintf('<tr><td rowspan="%s" colspan="0" class="bold">%s</td></tr>', $columnCount+1, h($tableName)); ?>
|
||||
<?php echo $rowHtml; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($columnCount > 0): ?>
|
||||
<?php echo sprintf('<tr><td rowspan="%s" colspan="0" class="bold">%s</td></tr>', $columnCount+1, h($tableName)); ?>
|
||||
<?php echo $rowHtml; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue