ServerFilesEvent events
7 FeatherPanel plugin events on ServerFilesEvent (6 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. 1 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import ServerFilesEvent 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\ServerFilesEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(ServerFilesEvent::onServerFileSaved(), function ($userUuid, $serverUuid, $filePath): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:file:saved ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid, 'file_path' => $filePath]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}ServerFilesEvent::onServerDirectoryCreated()
Docblock: string server uuid, string directory path. (the emitter passes 3 values, see the table)
Same event name as ServerEvent::onServerDirectoryCreated(). 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 | directory_path | $directoryPath | not declared |
When it fires (2 sites)
$event->on(ServerFilesEvent::onServerDirectoryCreated(), function ($userUuid, $serverUuid, $directoryPath): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:directory:created');
});ServerFilesEvent::onServerFileRenamed()
Docblock: string server uuid, string file path. (the emitter passes 4 values, see the table)
Same event name as ServerEvent::onServerFileRenamed(). 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 | root | $rootnot at every site | not declared |
| 4 | files | $filesnot at every site | not declared |
| Arguments passed | Emitted from |
|---|---|
user_uuid, server_uuid, root, files | ServerFilesController::renameFileOrFolder |
user_uuid, server_uuid, file_path, new_path | RenameFileTool::execute |
When it fires (2 sites)
$event->on(ServerFilesEvent::onServerFileRenamed(), function ($userUuid, $serverUuid, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:file:renamed');
});ServerFilesEvent::onServerFileSaved()
Docblock: string server uuid, string file path, int size.
Same event name as ServerEvent::onServerFileWritten(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
| 2 | server_uuid | $serverUuid | stringfrom docblock |
| 3 | file_path | $filePath | intfrom docblock |
When it fires (2 sites)
$event->on(ServerFilesEvent::onServerFileSaved(), function ($userUuid, $serverUuid, $filePath): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:file:saved ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid, 'file_path' => $filePath]));
});ServerFilesEvent::onServerFileUploaded()
Docblock: string server uuid, array file data. (the emitter passes 3 values, see the table)
Same event name as ServerEvent::onServerFileUploaded(). 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 | file_path | $filePath | not declared |
When it fires (1 site)
$event->on(ServerFilesEvent::onServerFileUploaded(), function ($userUuid, $serverUuid, $filePath): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:file:uploaded');
});ServerFilesEvent::onServerFilesDeleted()
Docblock: string server uuid, array files deleted.
Same event name as ServerEvent::onServerFilesDeleted(). A listener on either method receives the emits of both.
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | user_uuid | $userUuid | stringfrom docblock |
| 2 | server_uuid | $serverUuid | arrayfrom docblock |
| Arguments passed | Emitted from |
|---|---|
user_uuid, server_uuid | ServerFilesController::deleteFilesServerFilesController::wipeAllFiles |
user_uuid, server_uuid, files | DeleteFilesTool::execute |
When it fires (3 sites)
$event->on(ServerFilesEvent::onServerFilesDeleted(), function ($userUuid, $serverUuid, ...$rest): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:files:deleted ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid]));
});ServerFilesEvent::onServerFilesError()
Docblock: string error message, array context.
$event->on(ServerFilesEvent::onServerFilesError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:files:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
ServerFilesEvent::onServerPullProcessDeleted()
Docblock: string server uuid, string pull id. (the emitter passes 3 values, see the table)
Same event name as ServerEvent::onServerPullProcessDeleted(). 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 | pull_id | $pullId | string |
When it fires (1 site)
$event->on(ServerFilesEvent::onServerPullProcessDeleted(), function ($userUuid, $serverUuid, $pullId): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:pull:deleted ' . json_encode(['pull_id' => $pullId]));
});