fix: [galaxyClusterRelations] Bump cluster's timestamp after performing CRUD on relations

pull/7125/head
mokaddem 2021-03-01 15:56:04 +01:00
parent 4634da6e5f
commit 2e817c8ed8
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 12 additions and 0 deletions

View File

@ -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()) {

View File

@ -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
*