mirror of https://github.com/MISP/MISP
chg: [decaying] Added log entry if formula cannot be loaded
parent
cfafc2e51f
commit
813d222bf4
|
@ -416,7 +416,7 @@ class LogsController extends AppController
|
||||||
$this->set('actions', $actions);
|
$this->set('actions', $actions);
|
||||||
|
|
||||||
// combobox for models
|
// combobox for models
|
||||||
$models = array('Attribute', 'Event', 'EventBlacklist', 'EventTag', 'MispObject', 'Organisation', 'Post', 'Regexp', 'Role', 'Server', 'ShadowAttribute', 'SharingGroup', 'Tag', 'Task', 'Taxonomy', 'Template', 'Thread', 'User', 'Whitelist');
|
$models = array('Attribute', 'Event', 'EventBlacklist', 'EventTag', 'DecayingModel', 'MispObject', 'Organisation', 'Post', 'Regexp', 'Role', 'Server', 'ShadowAttribute', 'SharingGroup', 'Tag', 'Task', 'Taxonomy', 'Template', 'Thread', 'User', 'Whitelist');
|
||||||
$models = array('' => 'ALL') + $this->_arrayToValuesIndexArray($models);
|
$models = array('' => 'ALL') + $this->_arrayToValuesIndexArray($models);
|
||||||
$this->set('models', $models);
|
$this->set('models', $models);
|
||||||
$this->set('actionDefinitions', $this->{$this->defaultModel}->actionDefinitions);
|
$this->set('actionDefinitions', $this->{$this->defaultModel}->actionDefinitions);
|
||||||
|
|
|
@ -351,9 +351,24 @@ class DecayingModel extends AppModel
|
||||||
$full_path = APP . 'Model/DecayingModelsFormulas/' . $formula_files[$index];
|
$full_path = APP . 'Model/DecayingModelsFormulas/' . $formula_files[$index];
|
||||||
if (is_file($full_path)) {
|
if (is_file($full_path)) {
|
||||||
include_once $full_path;
|
include_once $full_path;
|
||||||
$model_class = ClassRegistry::init($expected_classname);
|
try {
|
||||||
if ($model_class->checkLoading() === 'BONFIRE LIT') {
|
$model_class = ClassRegistry::init($expected_classname);
|
||||||
return $model_class;
|
if ($model_class->checkLoading() === 'BONFIRE LIT') {
|
||||||
|
return $model_class;
|
||||||
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->Log = ClassRegistry::init('Log');
|
||||||
|
$this->Log->create();
|
||||||
|
$this->Log->save(array(
|
||||||
|
'org' => 'SYSTEM',
|
||||||
|
'model' => 'DecayingModel',
|
||||||
|
'model_id' => 0,
|
||||||
|
'email' => 'SYSTEM',
|
||||||
|
'action' => 'include_formula',
|
||||||
|
'title' => sprintf('Error while trying to include file `%s`: %s', $filename, $e->getMessage()),
|
||||||
|
'change' => ''
|
||||||
|
));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ class Log extends AppModel
|
||||||
'export',
|
'export',
|
||||||
'file_upload',
|
'file_upload',
|
||||||
'galaxy',
|
'galaxy',
|
||||||
|
'include_formula',
|
||||||
'login',
|
'login',
|
||||||
'login_fail',
|
'login_fail',
|
||||||
'logout',
|
'logout',
|
||||||
|
|
Loading…
Reference in New Issue