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);
|
||||
|
||||
// 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);
|
||||
$this->set('models', $models);
|
||||
$this->set('actionDefinitions', $this->{$this->defaultModel}->actionDefinitions);
|
||||
|
|
|
@ -351,10 +351,25 @@ class DecayingModel extends AppModel
|
|||
$full_path = APP . 'Model/DecayingModelsFormulas/' . $formula_files[$index];
|
||||
if (is_file($full_path)) {
|
||||
include_once $full_path;
|
||||
try {
|
||||
$model_class = ClassRegistry::init($expected_classname);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -35,6 +35,7 @@ class Log extends AppModel
|
|||
'export',
|
||||
'file_upload',
|
||||
'galaxy',
|
||||
'include_formula',
|
||||
'login',
|
||||
'login_fail',
|
||||
'logout',
|
||||
|
|
Loading…
Reference in New Issue