DeploymentHook: fix typo, keep compatibility

This commit is contained in:
Thomas Gelf 2020-01-18 00:18:38 +01:00
parent 81ad26fcab
commit 66fdeec923
3 changed files with 28 additions and 2 deletions

View File

@ -27,6 +27,7 @@ next (will be 1.8.0)
### Internals
* FEATURE: Property Modifiers are now able to clone rows (#2060)
* FIX: typo in DeploymentHook::onSuccessfulDump() has been fixed (#2069)
1.7.2
-----

View File

@ -853,7 +853,7 @@ constants
if ($succeeded === 'y') {
foreach ($hooks as $hook) {
$hook->onSuccessfullDump($deployment);
$hook->triggerSuccessfulDump($deployment);
}
}

View File

@ -18,11 +18,36 @@ abstract class DeploymentHook
/**
* Please override this method if you want to trigger custom actions
* on a successfull dump of the Icinga configuration
* on a successful dump of the Icinga configuration
*
* @param DirectorDeploymentLog $deployment
*/
public function onSuccessfulDump(DirectorDeploymentLog $deployment)
{
}
/**
* There is a typo in this method name, do not use this.
*
* @deprecated Please use onSuccessfulDump
* @param DirectorDeploymentLog $deployment
*/
public function onSuccessfullDump(DirectorDeploymentLog $deployment)
{
}
/**
* Compatibility helper
*
* The initial version of this hook had a typo in the onSuccessfulDump method
* That's why we call this hook, which then calls both the correct and the
* erroneous method to make sure that we do not break existing implementations.
*
* @param DirectorDeploymentLog $deploymentLog
*/
final public function triggerSuccessfulDump(DirectorDeploymentLog $deploymentLog)
{
$this->onSuccessfulDump($deploymentLog);
$this->onSuccessfullDump($deploymentLog);
}
}