View .md

FeatherZeroTrustEvent events

7 FeatherPanel plugin events on FeatherZeroTrustEvent (4 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. 3 of these events are declared but no code emits them yet; they are marked not emitted.

Setup

Import FeatherZeroTrustEvent 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\FeatherZeroTrustEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(FeatherZeroTrustEvent::onFeatherZeroTrustConfigRetrieved(), function ($config): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:config:retrieved ' . json_encode(['config' => $config]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

FeatherZeroTrustEvent::onFeatherZeroTrustConfigRetrieved()

Name: featherpanel:admin:featherzerotrust:config:retrievedemitted at 1 siteCancel or modify: nodefinition

Docblock: array config data.

#Payload keyListener parameterType
1config$configarrayfrom docblock
When it fires (1 site)
$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustConfigRetrieved(), function ($config): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:config:retrieved ' . json_encode(['config' => $config]));
});

FeatherZeroTrustEvent::onFeatherZeroTrustConfigUpdated()

Name: featherpanel:admin:featherzerotrust:config:updatedemitted at 1 siteCancel or modify: nodefinition

Docblock: array old config, array new config. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1old_config$oldConfignot declared
2new_config$newConfignot declared
3updated_by$updatedBynot declared
When it fires (1 site)
$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustConfigUpdated(), function ($oldConfig, $newConfig, $updatedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:config:updated');
});

FeatherZeroTrustEvent::onFeatherZeroTrustError()

Name: featherpanel:admin:featherzerotrust:errornot emittedCancel or modify: nodefinition

Docblock: string error message, array context.

$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustError(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:error ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

FeatherZeroTrustEvent::onFeatherZeroTrustLogsRetrieved()

Name: featherpanel:admin:featherzerotrust:logs:retrievednot emittedCancel or modify: nodefinition

Docblock: array logs data.

$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustLogsRetrieved(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:logs:retrieved ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

FeatherZeroTrustEvent::onFeatherZeroTrustScanCompleted()

Name: featherpanel:admin:featherzerotrust:scan:completedemitted at 1 siteCancel or modify: nodefinition

Docblock: string server uuid, array scan results. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1server_uuid$serverUuidnot declared
2scan_results$scanResultsnot declared
3detections_count$detectionsCountnot declared
When it fires (1 site)
$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustScanCompleted(), function ($serverUuid, $scanResults, $detectionsCount): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:scan:completed');
});

FeatherZeroTrustEvent::onFeatherZeroTrustScanError()

Name: featherpanel:admin:featherzerotrust:scan:errornot emittedCancel or modify: nodefinition

Docblock: string server uuid, string error message.

$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustScanError(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:scan:error ' . json_encode($args));
});

No code emits this event yet, so the arguments are unknown. The listener accepts any.

FeatherZeroTrustEvent::onFeatherZeroTrustScanStarted()

Name: featherpanel:admin:featherzerotrust:scan:startedemitted at 1 siteCancel or modify: nodefinition

Docblock: string server uuid, array scan data. (the emitter passes 4 values, see the table)

#Payload keyListener parameterType
1server_uuid$serverUuidnot declared
2directory$directorynot declared
3max_depth$maxDepthnot declared
4started_by$startedBynot declared
When it fires (1 site)
$event->on(FeatherZeroTrustEvent::onFeatherZeroTrustScanStarted(), function ($serverUuid, $directory, $maxDepth, $startedBy): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:featherzerotrust:scan:started');
});