mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:05:16 +02:00
Create event for dbstructure_definition hook
This commit is contained in:
parent
04818781a7
commit
9e3b0b3c40
5 changed files with 15 additions and 3 deletions
|
@ -70,6 +70,7 @@ final class HookEventBridge
|
|||
ArrayFilterEvent::ADD_WORKER_TASK => 'proc_run',
|
||||
ArrayFilterEvent::STORAGE_CONFIG => 'storage_config',
|
||||
ArrayFilterEvent::STORAGE_INSTANCE => 'storage_instance',
|
||||
ArrayFilterEvent::DB_STRUCTURE_DEFINITION => 'dbstructure_definition',
|
||||
HtmlFilterEvent::HEAD => 'head',
|
||||
HtmlFilterEvent::FOOTER => 'footer',
|
||||
HtmlFilterEvent::PAGE_HEADER => 'page_header',
|
||||
|
@ -120,6 +121,7 @@ final class HookEventBridge
|
|||
ArrayFilterEvent::ADD_WORKER_TASK => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::STORAGE_CONFIG => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::STORAGE_INSTANCE => 'onArrayFilterEvent',
|
||||
ArrayFilterEvent::DB_STRUCTURE_DEFINITION => 'onArrayFilterEvent',
|
||||
HtmlFilterEvent::HEAD => 'onHtmlFilterEvent',
|
||||
HtmlFilterEvent::FOOTER => 'onHtmlFilterEvent',
|
||||
HtmlFilterEvent::PAGE_HEADER => 'onHtmlFilterEvent',
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
namespace Friendica\Database\Definition;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Hook;
|
||||
use Friendica\DI;
|
||||
use Friendica\Event\ArrayFilterEvent;
|
||||
|
||||
/**
|
||||
* Stores the whole database definition
|
||||
|
@ -109,12 +109,16 @@ class DbaDefinition
|
|||
{
|
||||
$definition = require $this->configFile;
|
||||
|
||||
if (!$definition) {
|
||||
if (!is_array($definition)) {
|
||||
throw new Exception('Corrupted database structure config file static/dbstructure.config.php');
|
||||
}
|
||||
|
||||
if ($withAddonStructure) {
|
||||
Hook::callAll('dbstructure_definition', $definition);
|
||||
$eventDispatcher = DI::eventDispatcher();
|
||||
|
||||
$definition = $eventDispatcher->dispatch(
|
||||
new ArrayFilterEvent(ArrayFilterEvent::DB_STRUCTURE_DEFINITION, $definition),
|
||||
)->getArray();
|
||||
}
|
||||
|
||||
$this->definition = $definition;
|
||||
|
|
|
@ -78,6 +78,8 @@ final class ArrayFilterEvent extends Event
|
|||
|
||||
public const STORAGE_INSTANCE = 'friendica.data.storage_instance';
|
||||
|
||||
public const DB_STRUCTURE_DEFINITION = 'friendica.data.db_structure_definition';
|
||||
|
||||
private array $array;
|
||||
|
||||
public function __construct(string $name, array $array)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue