mirror of https://github.com/MISP/MISP
reportValidationIssues function
parent
342e5686a7
commit
435c52c457
|
@ -370,9 +370,11 @@ class AppController extends Controller {
|
||||||
if (!self::_isAdmin()) throw new NotFoundException();
|
if (!self::_isAdmin()) throw new NotFoundException();
|
||||||
print ("<h2>Listing invalid event validations</h2>");
|
print ("<h2>Listing invalid event validations</h2>");
|
||||||
$this->loadModel('Event');
|
$this->loadModel('Event');
|
||||||
|
// first remove executing some Behaviors because of Noud's crappy code
|
||||||
|
$this->Event->Behaviors->detach('Regexp');
|
||||||
|
$this->Event->Behaviors->detach('Blacklist');
|
||||||
// get all events..
|
// get all events..
|
||||||
$events = $this->Event->find('all',array('recursive' => -1));
|
$events = $this->Event->find('all', array('recursive' => -1));
|
||||||
debug($events);
|
|
||||||
// for all events..
|
// for all events..
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$this->Event->set($event);
|
$this->Event->set($event);
|
||||||
|
@ -390,13 +392,20 @@ class AppController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reportValidationIssuesAttributes() {
|
public function reportValidationIssuesAttributes() {
|
||||||
|
// TODO improve performance of this function by eliminating the additional SQL query per attribute
|
||||||
// search for validation problems in the attributes
|
// search for validation problems in the attributes
|
||||||
if (!self::_isAdmin()) throw new NotFoundException();
|
if (!self::_isAdmin()) throw new NotFoundException();
|
||||||
print ("<h2>Listing invalid attribute validations</h2>");
|
print ("<h2>Listing invalid attribute validations</h2>");
|
||||||
$this->loadModel('Attribute');
|
$this->loadModel('Attribute');
|
||||||
|
|
||||||
|
// first remove executing some Behaviors because of Noud's crappy code
|
||||||
|
$this->Attribute->Behaviors->detach('Regexp');
|
||||||
|
$this->Attribute->Behaviors->detach('Blacklist');
|
||||||
|
// for efficiency reasons remove the unique requirement
|
||||||
|
$this->Attribute->validator()->remove('value', 'unique');
|
||||||
|
|
||||||
// get all attributes..
|
// get all attributes..
|
||||||
// FIXME fetch attributes by batch of 1000 or so
|
$attributes = $this->Attribute->find('all', array('recursive' => -1));
|
||||||
$attributes = $this->Attribute->find('all',array('recursive' => -1));
|
|
||||||
// for all attributes..
|
// for all attributes..
|
||||||
foreach ($attributes as $attribute) {
|
foreach ($attributes as $attribute) {
|
||||||
$this->Attribute->set($attribute);
|
$this->Attribute->set($attribute);
|
||||||
|
|
Loading…
Reference in New Issue