mirror of https://github.com/MISP/MISP
fix: [galaxyClusterRelations] Bump cluster's timestamp after performing CRUD on relations
parent
4634da6e5f
commit
2e817c8ed8
|
@ -148,6 +148,7 @@ class GalaxyClusterRelationsController extends AppController
|
|||
|
||||
if (empty($errors)) {
|
||||
$message = __('Relationship added.');
|
||||
$this->GalaxyClusterRelation->SourceCluster->touchTimestamp($clusterSource['SourceCluster']['id']);
|
||||
$this->GalaxyClusterRelation->SourceCluster->unpublish($clusterSource['SourceCluster']['id']);
|
||||
} else {
|
||||
$message = __('Relationship could not be added.');
|
||||
|
@ -242,6 +243,7 @@ class GalaxyClusterRelationsController extends AppController
|
|||
|
||||
if (empty($errors)) {
|
||||
$message = __('Relationship added.');
|
||||
$this->GalaxyClusterRelation->SourceCluster->touchTimestamp($clusterSource['SourceCluster']['id']);
|
||||
$this->GalaxyClusterRelation->SourceCluster->unpublish($clusterSource['SourceCluster']['id']);
|
||||
} else {
|
||||
$message = __('Relationship could not be added.');
|
||||
|
@ -285,6 +287,7 @@ class GalaxyClusterRelationsController extends AppController
|
|||
$clusterSource = $this->GalaxyClusterRelation->SourceCluster->fetchIfAuthorized($this->Auth->user(), $relation['GalaxyClusterRelation']['galaxy_cluster_uuid'], array('edit', 'publish'), $throwErrors=true, $full=false);
|
||||
$result = $this->GalaxyClusterRelation->delete($id, true);
|
||||
if ($result) {
|
||||
$this->GalaxyClusterRelation->SourceCluster->touchTimestamp($clusterSource['SourceCluster']['id']);
|
||||
$this->GalaxyClusterRelation->SourceCluster->unpublish($clusterSource['SourceCluster']['id']);
|
||||
$message = __('Galaxy cluster relationship successfuly deleted.');
|
||||
if ($this->_isRest()) {
|
||||
|
|
|
@ -564,6 +564,15 @@ class GalaxyCluster extends AppModel
|
|||
), array('fieldList' => array('published', 'deleted', 'version')));
|
||||
}
|
||||
|
||||
public function touchTimestamp($id)
|
||||
{
|
||||
$version = (new DateTime())->getTimestamp();
|
||||
return $this->save(array(
|
||||
'id' => $id,
|
||||
'version' => $version,
|
||||
), array('fieldList' => array('version')));
|
||||
}
|
||||
|
||||
/**
|
||||
* uploadClusterToServersRouter Upload the cluster to all remote servers
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue