[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/plugins/system/schedulerunner/ -> schedulerunner.php (summary)

(no description)

Copyright: (C) 2021 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 374 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

PlgSystemSchedulerunner:: (8 methods):
  getSubscribedEvents()
  injectLazyJS()
  runLazyCron()
  runWebCron()
  runTestCron()
  runScheduler()
  enhanceSchedulerConfig()
  generateWebcronKey()


Class: PlgSystemSchedulerunner  - X-Ref

This plugin implements listeners to support a visitor-triggered lazy-scheduling pattern.
If `com_scheduler` is installed/enabled and its configuration allows unprotected lazy scheduling, this plugin
injects into each response with an HTML context a JS file {@see PlgSystemSchedulerunner::injectScheduleRunner()} that
sets up an AJAX callback to trigger the scheduler {@see PlgSystemSchedulerunner::runScheduler()}. This is achieved
through a call to the `com_ajax` component.
Also supports the scheduler component configuration form through auto-generation of the webcron key and injection
of JS of usability enhancement.

getSubscribedEvents()   X-Ref

return: string[]

injectLazyJS(EventInterface $event)   X-Ref
Inject JavaScript to trigger the scheduler in HTML contexts.

param: EventInterface  $event  The onBeforeCompileHead event.
return: void

runLazyCron(EventInterface $e)   X-Ref
Acts on the LazyCron trigger from the frontend when Lazy Cron is enabled in the Scheduler component
configuration. The lazy cron trigger is implemented in client-side JavaScript which is injected on every page
load with an HTML context when the component configuration allows it. This method then triggers the Scheduler,
which effectively runs the next Task in the Scheduler's task queue.

param: EventInterface  $e  The onAjaxRunSchedulerLazy event.
return: void

runWebCron(Event $event)   X-Ref
This method is responsible for the WebCron functionality of the Scheduler component.<br/>
Acting on a `com_ajax` call, this method can work in two ways:
1. If no Task ID is specified, it triggers the Scheduler to run the next task in
the task queue.
2. If a Task ID is specified, it fetches the task (if it exists) from the Scheduler API and executes it.<br/>

URL query parameters:
- `hash` string (required)   Webcron hash (from the Scheduler component configuration).
- `id`   int (optional)      ID of the task to trigger.

param: Event  $event  The onAjaxRunSchedulerWebcron event.
return: void

runTestCron(Event $event)   X-Ref
This method is responsible for the "test run" functionality in the Scheduler administrator backend interface.
Acting on a `com_ajax` call, this method requires the URL to have a `id` query parameter (corresponding to an
existing Task ID).

param: Event  $event  The onAjaxRunScheduler event.
return: void

runScheduler(int $id = 0)   X-Ref
Run the scheduler, allowing execution of a single due task.
Does not bypass task scheduling, meaning that even if an ID is passed the task is only
triggered if it is due.

param: integer  $id  The optional ID of the task to run
return: ?Task

enhanceSchedulerConfig(EventInterface $event)   X-Ref
Enhance the scheduler config form by dynamically populating or removing display fields.

param: EventInterface  $event  The onContentPrepareForm event.
return: void

generateWebcronKey(EventInterface $event)   X-Ref
Auto-generate a key/hash for the webcron functionality.
This method acts on table save, when a hash doesn't already exist or a reset is required.

param: EventInterface  $event The onExtensionBeforeSave event.
return: void



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer