mirror of
https://github.com/friendica/friendica
synced 2024-11-18 18:23:40 +00:00
Add some hook to check if hook should be forked
This commit is contained in:
parent
d4a02dc314
commit
e30d7cfc03
1 changed files with 17 additions and 0 deletions
|
@ -7,6 +7,7 @@ namespace Friendica\Core;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\Core\Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some functions to handle hooks
|
* Some functions to handle hooks
|
||||||
|
@ -136,6 +137,22 @@ class Hook extends BaseObject
|
||||||
{
|
{
|
||||||
if (array_key_exists($name, self::$hooks)) {
|
if (array_key_exists($name, self::$hooks)) {
|
||||||
foreach (self::$hooks[$name] as $hook) {
|
foreach (self::$hooks[$name] as $hook) {
|
||||||
|
// Call a hook to check if this hook call needs to be forked
|
||||||
|
$hookdata = ['name' => $name, 'data' => $data, 'execute' => true];
|
||||||
|
|
||||||
|
if (array_key_exists('hook_fork', self::$hooks)) {
|
||||||
|
foreach (self::$hooks['hook_fork'] as $fork_hook) {
|
||||||
|
if ($hook[0] != $fork_hook[0]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
self::callSingle(self::getApp(), 'hook_fork', $fork_hook, $hookdata);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hookdata['execute']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Worker::add($priority, 'ForkHook', $name, $hook, $data);
|
Worker::add($priority, 'ForkHook', $name, $hook, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue