mirror of https://github.com/MISP/MISP
fix: more issues with PostgreSQL
- fixed error during update Job date_modified field (SQLSTATE[22008]: Datetime field overflow: 7 ERROR: date/time field value out of range) - fixed error during fetching events while updating from feeds ( SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table events) - fixed Feed edit view with wrong boolean forms (combobox instead checkbox)pull/5083/head
parent
94518ce5c7
commit
9cf2ef3a46
|
@ -54,7 +54,7 @@ class AdminShell extends AppShell
|
|||
$this->Job->id = $jobId;
|
||||
$result = $this->Server->updateAfterPull($submodule_name, $userId);
|
||||
$this->Job->saveField('progress', 100);
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
if ($result) {
|
||||
$this->Job->saveField('message', __('Database updated: ' . $submodule_name));
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,7 @@ class EventShell extends AppShell
|
|||
$this->Job->saveField('progress', 100);
|
||||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('message', 'Job Failed due to invalid export format. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
return false;
|
||||
}
|
||||
if ($export_type == 'text') {
|
||||
|
@ -65,7 +65,7 @@ class EventShell extends AppShell
|
|||
$this->Job->saveField('progress', 100);
|
||||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
private function __runCaching($user, $typeData, $id, $export_type, $subType = '')
|
||||
|
@ -115,7 +115,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', 100);
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cachejson() {
|
||||
|
@ -149,7 +149,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', 100);
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cachestix() {
|
||||
|
@ -166,7 +166,7 @@ class EventShell extends AppShell
|
|||
}
|
||||
$result = $this->Event->stix(false, false, Configure::read('MISP.cached_attachments'), $user, 'xml', false, false, false, $id, true);
|
||||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
if ($result['success']) {
|
||||
rename($result['data'], $stixFilePath);
|
||||
unlink($result['data']);
|
||||
|
@ -231,7 +231,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', '100');
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cacherpz() {
|
||||
|
@ -272,7 +272,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', '100');
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cachecsv() {
|
||||
|
@ -311,7 +311,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', '100');
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cachetext() {
|
||||
|
@ -340,7 +340,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', 100);
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cachenids() {
|
||||
|
@ -376,7 +376,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = time()-$timeStart;
|
||||
$this->Job->saveField('progress', '100');
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function cachebro()
|
||||
|
@ -411,7 +411,7 @@ class EventShell extends AppShell
|
|||
$timeDelta = (time()-$timeStart);
|
||||
$this->Job->saveField('progress', 100);
|
||||
$this->Job->saveField('message', 'Job done. (in '.$timeDelta.'s)');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
}
|
||||
|
||||
public function alertemail() {
|
||||
|
@ -424,7 +424,7 @@ class EventShell extends AppShell
|
|||
$result = $this->Event->sendAlertEmail($eventId, $user, $oldpublish, $processId);
|
||||
$job['Job']['progress'] = 100;
|
||||
$job['Job']['message'] = 'Emails sent.';
|
||||
//$job['Job']['date_modified'] = date("y-m-d H:i:s");
|
||||
//$job['Job']['date_modified'] = date("Y-m-d H:i:s");
|
||||
$this->Job->save($job);
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ class EventShell extends AppShell
|
|||
$user = $this->User->getAuthUser($userId);
|
||||
$result = $this->Event->sendContactEmail($id, $message, $all, array('User' => $user), $isSiteAdmin);
|
||||
$this->Job->saveField('progress', '100');
|
||||
$this->Job->saveField('date_modified', date("y-m-d H:i:s"));
|
||||
$this->Job->saveField('date_modified', date("Y-m-d H:i:s"));
|
||||
if ($result != true) $this->Job->saveField('message', 'Job done.');
|
||||
}
|
||||
|
||||
|
@ -454,7 +454,7 @@ class EventShell extends AppShell
|
|||
$result = $this->Post->sendPostsEmail($userId, $postId, $eventId, $title, $message);
|
||||
$job['Job']['progress'] = 100;
|
||||
$job['Job']['message'] = 'Emails sent.';
|
||||
$job['Job']['date_modified'] = date("y-m-d H:i:s");
|
||||
$job['Job']['date_modified'] = date("Y-m-d H:i:s");
|
||||
$this->Job->save($job);
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ class EventShell extends AppShell
|
|||
$this->Event->Behaviors->unload('SysLogLogable.SysLogLogable');
|
||||
$result = $this->Event->publish($id, $passAlong);
|
||||
$job['Job']['progress'] = 100;
|
||||
$job['Job']['date_modified'] = date("y-m-d H:i:s");
|
||||
$job['Job']['date_modified'] = date("Y-m-d H:i:s");
|
||||
if ($result) {
|
||||
$job['Job']['message'] = 'Event published.';
|
||||
} else {
|
||||
|
@ -569,7 +569,7 @@ class EventShell extends AppShell
|
|||
);
|
||||
$result = $this->Event->enrichment($options);
|
||||
$job['Job']['progress'] = 100;
|
||||
$job['Job']['date_modified'] = date("y-m-d H:i:s");
|
||||
$job['Job']['date_modified'] = date("Y-m-d H:i:s");
|
||||
if ($result) {
|
||||
$job['Job']['message'] = 'Added ' . $result . ' attribute' . ($result > 1 ? 's.' : '.');
|
||||
} else {
|
||||
|
|
|
@ -1883,6 +1883,13 @@ class Event extends AppModel
|
|||
$delegatedEventIDs = $this->__cachedelegatedEventIDs($user, $useCache);
|
||||
$conditions['AND']['OR']['Event.id'] = $delegatedEventIDs;
|
||||
}
|
||||
$attributeCondSelect = '(SELECT events.org_id FROM events WHERE events.id = Attribute.event_id)';
|
||||
$objectCondSelect = '(SELECT events.org_id FROM events WHERE events.id = Object.event_id)';
|
||||
if ($this->getDataSource()->config['datasource'] == 'Database/Postgres') {
|
||||
$schemaName = $this->getDataSource()->config['schema'];
|
||||
$attributeCondSelect = sprintf('(SELECT "%s"."events"."org_id" FROM "%s"."events" WHERE "%s"."events"."id" = "Attribute"."event_id")', $schemaName, $schemaName, $schemaName);
|
||||
$objectCondSelect = sprintf('(SELECT "%s"."events"."org_id" FROM "%s"."events" WHERE "%s"."events"."id" = "Object"."event_id")', $schemaName, $schemaName, $schemaName);
|
||||
}
|
||||
$conditionsAttributes['AND'][0]['OR'] = array(
|
||||
array('AND' => array(
|
||||
'Attribute.distribution >' => 0,
|
||||
|
@ -1892,7 +1899,7 @@ class Event extends AppModel
|
|||
'Attribute.distribution' => 4,
|
||||
'Attribute.sharing_group_id' => $sgids,
|
||||
)),
|
||||
'(SELECT events.org_id FROM events WHERE events.id = Attribute.event_id)' => $user['org_id']
|
||||
$attributeCondSelect => $user['org_id']
|
||||
);
|
||||
|
||||
$conditionsObjects['AND'][0]['OR'] = array(
|
||||
|
@ -1904,7 +1911,7 @@ class Event extends AppModel
|
|||
'Object.distribution' => 4,
|
||||
'Object.sharing_group_id' => $sgids,
|
||||
)),
|
||||
'(SELECT events.org_id FROM events WHERE events.id = Object.event_id)' => $user['org_id']
|
||||
$objectCondSelect => $user['org_id']
|
||||
);
|
||||
}
|
||||
if ($options['distribution']) {
|
||||
|
|
|
@ -4,12 +4,18 @@
|
|||
<legend><?php echo __('Edit MISP Feed');?></legend>
|
||||
<p><?php echo __('Edit a new MISP feed source.');?></p>
|
||||
<?php
|
||||
echo $this->Form->input('enabled', array());
|
||||
echo $this->Form->input('caching_enabled', array());
|
||||
echo $this->Form->input('enabled', array(
|
||||
'type' => 'checkbox'
|
||||
));
|
||||
echo $this->Form->input('caching_enabled', array(
|
||||
'type' => 'checkbox'
|
||||
));
|
||||
?>
|
||||
<div class="input clear"></div>
|
||||
<?php
|
||||
echo $this->Form->input('lookup_visible', array());
|
||||
echo $this->Form->input('lookup_visible', array(
|
||||
'type' => 'checkbox'
|
||||
));
|
||||
echo $this->Form->input('name', array(
|
||||
'div' => 'input clear',
|
||||
'placeholder' => __('Feed name'),
|
||||
|
|
Loading…
Reference in New Issue