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'];
|
$dbVersion = $dbVersion['AdminSetting']['value'];
|
||||||
$data = array(
|
$data = array(
|
||||||
'schema' => $dbActualSchema['schema'],
|
'schema' => $dbActualSchema['schema'],
|
||||||
'indexes' => $dbActualSchema['indexes']
|
'indexes' => $dbActualSchema['indexes'],
|
||||||
'db_version' => $dbVersion
|
'db_version' => $dbVersion
|
||||||
);
|
);
|
||||||
$file = new File(ROOT . DS . 'db_schema.json', true);
|
$file = new File(ROOT . DS . 'db_schema.json', true);
|
||||||
|
|
|
@ -4640,14 +4640,6 @@ class Server extends AppModel
|
||||||
|
|
||||||
public function compareDBIndexes($actualIndex, $expectedIndex)
|
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();
|
$indexDiff = array();
|
||||||
foreach($expectedIndex as $tableName => $indexes) {
|
foreach($expectedIndex as $tableName => $indexes) {
|
||||||
if (!array_key_exists($tableName, $actualIndex)) {
|
if (!array_key_exists($tableName, $actualIndex)) {
|
||||||
|
|
|
@ -9,44 +9,48 @@
|
||||||
<strong><?php echo __('Notice'); ?></strong>
|
<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.'); ?>
|
<?php echo __('The highlighted issues may be benign. if you are unsure, please open an issue and ask for clarification.'); ?>
|
||||||
</div>
|
</div>
|
||||||
<table id="tableDBIndexes" class="table table-condensed table-bordered">
|
<?php if(empty($diagnostic)): ?>
|
||||||
<thead>
|
<span class="label label-success"><?php echo __('Index diagnostic:'); ?><i class="fa fa-check"></i></span>
|
||||||
<tr>
|
<?php else: ?>
|
||||||
<th>Table name</th>
|
<table id="tableDBIndexes" class="table table-condensed table-bordered">
|
||||||
<th>Column name</th>
|
<thead>
|
||||||
<th>Indexed</th>
|
<tr>
|
||||||
<th>Description</th>
|
<th>Table name</th>
|
||||||
</tr>
|
<th>Column name</th>
|
||||||
</thead>
|
<th>Indexed</th>
|
||||||
<tbody>
|
<th>Description</th>
|
||||||
<?php foreach($columnPerTable as $tableName => $columnArray): ?>
|
</tr>
|
||||||
<?php
|
</thead>
|
||||||
$columnCount = 0;
|
<tbody>
|
||||||
$rowHtml = '';
|
<?php foreach($columnPerTable as $tableName => $columnArray): ?>
|
||||||
?>
|
|
||||||
<?php foreach($columnArray as $columnName): ?>
|
|
||||||
<?php
|
<?php
|
||||||
$columnIndexed = !empty($indexes[$tableName]) && in_array($columnName, $indexes[$tableName]);
|
$columnCount = 0;
|
||||||
$warning = isset($diagnostic[$tableName][$columnName]);
|
$rowHtml = '';
|
||||||
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 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 endforeach; ?>
|
||||||
<?php if ($columnCount > 0): ?>
|
</tbody>
|
||||||
<?php echo sprintf('<tr><td rowspan="%s" colspan="0" class="bold">%s</td></tr>', $columnCount+1, h($tableName)); ?>
|
</table>
|
||||||
<?php echo $rowHtml; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue