mirror of https://github.com/MISP/MISP
chg: [internal] Move getting missing tlds list to model
parent
ce3581c291
commit
7173663c19
|
@ -3634,19 +3634,7 @@ class EventsController extends AppController
|
|||
$this->set('importComment', '');
|
||||
$this->set('title', 'Freetext Import Results');
|
||||
$this->loadModel('Warninglist');
|
||||
$tldLists = $this->Warninglist->getTldLists();
|
||||
$missingTldLists = array();
|
||||
foreach ($tldLists as $tldList) {
|
||||
$temp = $this->Warninglist->find('first', array(
|
||||
'recursive' => -1,
|
||||
'conditions' => array('Warninglist.name' => $tldList),
|
||||
'fields' => array('Warninglist.id')
|
||||
));
|
||||
if (empty($temp)) {
|
||||
$missingTldLists[] = $tldList;
|
||||
}
|
||||
}
|
||||
$this->set('missingTldLists', $missingTldLists);
|
||||
$this->set('missingTldLists', $this->Warninglist->missingTldLists());
|
||||
$this->render('resolved_attributes');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -684,4 +684,20 @@ class Warninglist extends AppModel
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function missingTldLists()
|
||||
{
|
||||
$missingTldLists = array();
|
||||
foreach ($this->__tlds as $tldList) {
|
||||
$temp = $this->find('first', array(
|
||||
'recursive' => -1,
|
||||
'conditions' => array('Warninglist.name' => $tldList),
|
||||
'fields' => array('Warninglist.id')
|
||||
));
|
||||
if (empty($temp)) {
|
||||
$missingTldLists[] = $tldList;
|
||||
}
|
||||
}
|
||||
return $missingTldLists;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue