Revert "Module: Drop deprecated method registerHook and arg $key of method provideHook"
This reverts commit f1a1f41192
.
It makes absolutely sense to remove depcreated code, but this removal introduces too many problems while not being really necessary.
Some of our modules and modules written by others still rely on the deprecated code. A upgrade of Icinga Web 2 would break many running systems out there.
Before removing this code we should upgrade our modules and notify the authors of other modules about the deprecation.
Further, we should maintain something like a deprecation info file because nobody reads @deprecated tags.
All of the above will not protect us from systems where modules aren't up to date. We also have to implement a mechanism where it is still possible to disable faulty modules.
This commit is contained in:
parent
ecdf96c588
commit
1cdef234a1
|
@ -1242,6 +1242,22 @@ class Module
|
|||
return $this->includeScript($this->configScript);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a hook
|
||||
*
|
||||
* @param string $name Name of the hook
|
||||
* @param string $class Class of the hook w/ namespace
|
||||
* @param string $key
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @deprecated Deprecated in favor of {@link provideHook()}. Will be removed in version 2.2.0
|
||||
*/
|
||||
protected function registerHook($name, $class, $key = null)
|
||||
{
|
||||
return $this->provideHook($name, $class, $key);
|
||||
}
|
||||
|
||||
protected function slashesToNamespace($class)
|
||||
{
|
||||
$list = explode('/', $class);
|
||||
|
@ -1259,10 +1275,12 @@ class Module
|
|||
* @param string $implementation [optional] Fully qualified name of the class providing the hook implementation.
|
||||
* Defaults to the module's ProvidedHook namespace plus the hook's name for the
|
||||
* class name. Web 2's namespace separator is \\ (double backslash) at the moment
|
||||
* @param string $key No-op arg for compatibility reasons. This argument is deprecated and will be
|
||||
* removed in version 2.2.0
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function provideHook($name, $implementation = null)
|
||||
protected function provideHook($name, $implementation = null, $key = null)
|
||||
{
|
||||
if ($implementation === null) {
|
||||
$implementation = $name;
|
||||
|
|
Loading…
Reference in New Issue