Skip to content

Commit

Permalink
DDST-382: Handle errors while deleting orphaned embargo
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant-bd committed Jul 29, 2024
1 parent b13c6c9 commit 14fb7a2
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/Entity/Embargo.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,29 +397,33 @@ public function getCacheMaxAge() {
* {@inheritdoc}
*/
public function getCacheTags() {
$tags = Cache::mergeTags(parent::getCacheTags(), $this->getEmbargoedNode()->getCacheTags());
if ($this->getEmbargoedNode() !== NULL) {
$tags = Cache::mergeTags(parent::getCacheTags(), $this->getEmbargoedNode()->getCacheTags());

if ($this->getExemptIps()) {
$tags = Cache::mergeTags($tags, $this->getExemptIps()->getCacheTags());
if ($this->getExemptIps()) {
$tags = Cache::mergeTags($tags, $this->getExemptIps()->getCacheTags());
}
return $tags;
}
return $tags;
}

/**
* {@inheritDoc}
*/
public function getCacheContexts() {
$contexts = Cache::mergeContexts(
parent::getCacheContexts(),
$this->getEmbargoedNode()->getCacheContexts(),
['user.embargo__has_exemption'],
);

if ($this->getExemptIps()) {
$contexts = Cache::mergeContexts($contexts, $this->getExemptIps()->getCacheContexts());
if ($this->getEmbargoedNode() !== NULL) {
$contexts = Cache::mergeContexts(
parent::getCacheContexts(),
$this->getEmbargoedNode()->getCacheContexts(),
['user.embargo__has_exemption'],
);

if ($this->getExemptIps()) {
$contexts = Cache::mergeContexts($contexts, $this->getExemptIps()->getCacheContexts());
}

return $contexts;
}

return $contexts;
}

/**
Expand Down

0 comments on commit 14fb7a2

Please sign in to comment.