View .md

ServerScheduleEvent events

5 FeatherPanel plugin events on ServerScheduleEvent (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 ServerScheduleEvent 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\ServerScheduleEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(ServerScheduleEvent::onServerScheduleUpdated(), function ($userUuid, $serverUuid, $scheduleId): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:schedule:updated ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid, 'schedule_id' => $scheduleId]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

ServerScheduleEvent::onServerScheduleCreated()

Name: featherpanel:user:server:schedule:createdemitted at 3 sitesCancel or modify: nodefinition

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

Same event name as ServerEvent::onServerScheduleCreated(). A listener on either method receives the emits of both.

#Payload keyListener parameterType
1user_uuid$userUuidnot declared
2server_uuid$serverUuidnot declared
3schedule_id$scheduleIdnot declared
When it fires (3 sites)
$event->on(ServerScheduleEvent::onServerScheduleCreated(), function ($userUuid, $serverUuid, $scheduleId): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:schedule:created');
});

ServerScheduleEvent::onServerScheduleDeleted()

Name: featherpanel:user:server:schedule:deletedemitted at 2 sitesCancel or modify: nodefinition

Docblock: string server uuid, int schedule id. (the emitter passes 3 values, see the table)

Same event name as ServerEvent::onServerScheduleDeleted(). A listener on either method receives the emits of both.

#Payload keyListener parameterType
1user_uuid$userUuidnot declared
2server_uuid$serverUuidnot declared
3schedule_id$scheduleIdint
When it fires (2 sites)
$event->on(ServerScheduleEvent::onServerScheduleDeleted(), function ($userUuid, $serverUuid, $scheduleId): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:schedule:deleted ' . json_encode(['schedule_id' => $scheduleId]));
});

ServerScheduleEvent::onServerScheduleError()

Name: featherpanel:user:server:schedule:errornot emittedCancel or modify: nodefinition

Docblock: string error message, array context.

$event->on(ServerScheduleEvent::onServerScheduleError(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:schedule:error ' . json_encode($args));
});

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

ServerScheduleEvent::onServerScheduleTriggered()

Name: featherpanel:user:server:schedule:triggerednot emittedCancel or modify: nodefinition

Docblock: string server uuid, int schedule id.

$event->on(ServerScheduleEvent::onServerScheduleTriggered(), function (...$args): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:schedule:triggered ' . json_encode($args));
});

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

ServerScheduleEvent::onServerScheduleUpdated()

Name: featherpanel:user:server:schedule:updatedemitted at 3 sitesCancel or modify: nodefinition

Docblock: string server uuid, int schedule id, array updated data.

Same event name as ServerEvent::onServerScheduleUpdated(). A listener on either method receives the emits of both.

#Payload keyListener parameterType
1user_uuid$userUuidstringfrom docblock
2server_uuid$serverUuidintfrom docblock
3schedule_id$scheduleIdint
When it fires (3 sites)
$event->on(ServerScheduleEvent::onServerScheduleUpdated(), function ($userUuid, $serverUuid, $scheduleId): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:user:server:schedule:updated ' . json_encode(['user_uuid' => $userUuid, 'server_uuid' => $serverUuid, 'schedule_id' => $scheduleId]));
});