ServerBackupEvent events
5 FeatherPanel plugin events on ServerBackupEvent (3 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 ServerBackupEvent 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\ServerBackupEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(ServerBackupEvent::onServerBackupCreated(), function ($userUuid, $serverUuid, $backupUuid, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:backup:created');
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}ServerBackupEvent::onServerBackupCreated()
Docblock: string server uuid, array backup data. (the emitter passes 3 values, see the table)
Same event name as ServerEvent::onServerBackupCreated(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | server_uuid | $serverUuid | not declared |
| 3 | backup_uuid | $backupUuid | not declared |
| Arguments passed | Emitted from |
|---|---|
user_uuid, server_uuid, backup_uuid | ServerBackupController::createBackup |
user_uuid, server_uuid, backup_uuid, type | ServerBackupController::createFullBackup |
user_uuid, server_uuid, backup_uuid, backup_data | CreateBackupTool::execute |
When it fires (3 sites)
$event->on(ServerBackupEvent::onServerBackupCreated(), function ($userUuid, $serverUuid, $backupUuid, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:backup:created');
});ServerBackupEvent::onServerBackupDeleted()
Docblock: string server uuid, string backup uuid. (the emitter passes 3 values, see the table)
Same event name as ServerEvent::onServerBackupDeleted(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | server_uuid | $serverUuid | not declared |
| 3 | backup_uuid | $backupUuid | string |
When it fires (3 sites)
$event->on(ServerBackupEvent::onServerBackupDeleted(), function ($userUuid, $serverUuid, $backupUuid): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:backup:deleted ' . json_encode(['backup_uuid' => $backupUuid]));
});ServerBackupEvent::onServerBackupDownloaded()
Docblock: string server uuid, string backup uuid, string download url.
$event->on(ServerBackupEvent::onServerBackupDownloaded(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:backup:downloaded ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
ServerBackupEvent::onServerBackupError()
Docblock: string error message, array context.
$event->on(ServerBackupEvent::onServerBackupError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:backup:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
ServerBackupEvent::onServerBackupRestored()
Docblock: string server uuid, string backup uuid. (the emitter passes 3 values, see the table)
Same event name as ServerEvent::onServerBackupRestored(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | not declared |
| 2 | server_uuid | $serverUuid | not declared |
| 3 | backup_uuid | $backupUuid | string |
When it fires (1 site)
$event->on(ServerBackupEvent::onServerBackupRestored(), function ($userUuid, $serverUuid, $backupUuid): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:backup:restored ' . json_encode(['backup_uuid' => $backupUuid]));
});