Use try-finally for delete transient on error
[MAILPOET-3656]
This commit is contained in:
@@ -29,8 +29,11 @@ class Activator {
|
|||||||
$isRunning = $this->wp->getTransient(self::TRANSIENT_ACTIVATE_KEY);
|
$isRunning = $this->wp->getTransient(self::TRANSIENT_ACTIVATE_KEY);
|
||||||
if ($isRunning === false) {
|
if ($isRunning === false) {
|
||||||
$this->wp->setTransient(self::TRANSIENT_ACTIVATE_KEY, '1', self::TRANSIENT_EXPIRATION);
|
$this->wp->setTransient(self::TRANSIENT_ACTIVATE_KEY, '1', self::TRANSIENT_EXPIRATION);
|
||||||
$this->processActivate();
|
try {
|
||||||
$this->wp->deleteTransient(self::TRANSIENT_ACTIVATE_KEY);
|
$this->processActivate();
|
||||||
|
} finally {
|
||||||
|
$this->wp->deleteTransient(self::TRANSIENT_ACTIVATE_KEY);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidStateException(__('MailPoet version update is in progress, please refresh the page in a minute.', 'mailpoet'));
|
throw new InvalidStateException(__('MailPoet version update is in progress, please refresh the page in a minute.', 'mailpoet'));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user