DatabaseManagementEvent events
3 FeatherPanel plugin events on DatabaseManagementEvent (1 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions. 2 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import DatabaseManagementEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\DatabaseManagementEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(DatabaseManagementEvent::onMigrationsExecuted(), function ($executed, $skipped, $failed, $totalTime, $executedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:database_management:migrations:executed ' . json_encode(['executed' => $executed, 'skipped' => $skipped, 'failed' => $failed]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}DatabaseManagementEvent::onDatabaseManagementError()
Docblock: string error message, array context.
$event->on(DatabaseManagementEvent::onDatabaseManagementError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:database_management:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
DatabaseManagementEvent::onMigrationsExecuted()
Docblock: array migration results. (the emitter passes 5 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | executed | $executed | int |
| 2 | skipped | $skipped | int |
| 3 | failed | $failed | int |
| 4 | total_time | $totalTime | not declared |
| 5 | executed_by | $executedBy | not declared |
When it fires (1 site)
$event->on(DatabaseManagementEvent::onMigrationsExecuted(), function ($executed, $skipped, $failed, $totalTime, $executedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:database_management:migrations:executed ' . json_encode(['executed' => $executed, 'skipped' => $skipped, 'failed' => $failed]));
});DatabaseManagementEvent::onStatusRetrieved()
Docblock: array status data.
$event->on(DatabaseManagementEvent::onStatusRetrieved(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:database_management:status:retrieved ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.