Contentserv PHP API

CSStagingEventQueueScript extends CSActiveScriptPlugin
in package

The base of all ActiveScript plugins To be included, it must be placed in a plugins/script subfolder with a file name ending with Script.php.

Tags

Table of Contents

EXECUTION_TIME_LIMIT  = 1800
Default execution time limit for the script.
__call()  : mixed|string
All method calls which are not defined within the plugin are forwarded to the module Therefore it is possible to get, e.g. the label by calling the getSuiteName() method.
_construct()  : void
The construct method may be used to initialize custom plugin properties it is called immediately after instantiating the plugin all arguments passed to the getPlugins method are also available in this method.
addAlternativePluginFolder()  : void
A path to a specific folder in which should be search for plugins.
addSteps()  : void
Fetches the staging events from the queue and adds them to the StepList
canBeInterrupted()  : bool
Tells if the script can be interrupted, to allow to disable Stop and Pause buttons.
canInterruptBeforeStep()  : bool
Will be called by the framework when the job is requested to interrupt
checkInterruptionRequest()  : void
Checks if an interruption request is being available for the current job. If so and the interruption is confirmed, the job gets interrupted.
getActiveScript()  : CSActiveScript
Returns the ActiveScript
getActiveScriptJob()  : CSActiveScriptJob
Returns the ActiveScriptJob
getAlternativePluginFolder()  : array<string|int, mixed>
getAvailableSleepDurationsPerStep()  : array<string|int, int>
Allows the plugin to provide a list of predefined numbers of microseconds the script should be able to sleep between each step.
getIcon()  : string
getLevel()  : int
The getLevel method may be overwritten in the plugins and defines the order, the plugins are called, where the highest level is called first.
getMetaData()  : CSMetaData
Returns the CSMetaData of the current plugin.
getModule()  : CSModule
Returns the module, if the plugin is defined within a module.
getOutputKeys()  : array<string|int, string>
Lets a plugin developer tell which output his script will provide
getPlugin()  : CSPlugin|null
Returns a CSPlugin for the given plugin type and plugin class name.
getPluginChooser()  : array<string|int, mixed>
Returns an array all defined CSPlugins for the current plugin type
getPluginData()  : mixed
getPluginDefinitionFile()  : string
Returns the path to the file, the plugin is defined.
getPluginName()  : string
Defines how the plugin will show up in the script plugin dropdown
getPlugins()  : array<string|int, CSPlugin>
Returns all defined CSPlugins for the current plugin type It should be used to get all matching plugins for a given plugin api.
getPluginsInModule()  : array<string|int, mixed>
Returns all CSPlugins for the current plugin type which are defined within the given module It should be used to get all matching plugins for a given plugin api.
isAvailable()  : bool
This method is called to check, whether the plugin is available.
isAvailableForCurrentUser()  : bool
Tells if this script is available for the current user outside of the actual editor
isReadyToRerun()  : bool
If a job is configured to be kept alive, this method is called after each iteration to check if the next iteration should be started. It should be overwritten on plugin side to do a check if new data is available to be processed by the job.
onAfterRunScript()  : void
Will be called by the framework after the script was executed. Compared to the onBeforeRunSteps-method, when it is called, all other tasks are already finished.
onAfterRunSteps()  : void
Will be called by the framework after each step was executed
onBeforeAutomaticResume()  : void
Will be called by the framework before a job is resumed after being stopped in an unusual way.
onBeforeRunScript()  : void
Will be called by the framework before the script is executed.
onBeforeRunSteps()  : void
Will be called by the framework before each step is executed
prepareEditor()  : void
Makes the Export Database Active Script read-only
resetLoadedPlugins()  : mixed
reset the internal plugins cache for loaded plugins
run()  : mixed
This is the most important method to implement when defining your CSOpenSearch Here the search is executed and the found IDs will be added to the Response
runStep()  : mixed
Processes the fetched events.
setActiveScript()  : mixed
Sets the ActiveScript
setActiveScriptJob()  : void
Sets the active script
shouldBeKeptAlive()  : bool
Returns whether the job should be kept alive by the framework. Only CORE jobs are allowed to define itself as such.
shouldBeSelectableInGui()  : bool
Tells if the plugin wishes to be selectable by a user in the script editor.
shouldIgnoreExecutionFlag()  : bool
Function to validate if the execution should skip automation settings
supportsAutomaticResume()  : bool
Tells if the plugin supports automatic resume in case the job has been stopped in an unusual way (like webserver crashes). In case it returns true the script will automatically be resumed when a webserver is started again and the script was running at the time it was stopped.

Constants

EXECUTION_TIME_LIMIT

Default execution time limit for the script.

public int EXECUTION_TIME_LIMIT = 1800
Tags
deprecated

Should not be used anymore. Please use the protected method "_getExecutionTimeLimit()"

Methods

__call()

All method calls which are not defined within the plugin are forwarded to the module Therefore it is possible to get, e.g. the label by calling the getSuiteName() method.

public __call(mixed $methodName, mixed $methodArguments) : mixed|string
Parameters
$methodName : mixed
$methodArguments : mixed
Tags
Return values
mixed|string

_construct()

The construct method may be used to initialize custom plugin properties it is called immediately after instantiating the plugin all arguments passed to the getPlugins method are also available in this method.

public _construct() : void
Tags
Return values
void

addAlternativePluginFolder()

A path to a specific folder in which should be search for plugins.

public static addAlternativePluginFolder(mixed $sPluginFolder) : void
Parameters
$sPluginFolder : mixed
Tags
Return values
void

canBeInterrupted()

Tells if the script can be interrupted, to allow to disable Stop and Pause buttons.

public canBeInterrupted() : bool
Tags
access

public

Return values
bool

true if the script can be interrupted, otherwise false.

canInterruptBeforeStep()

Will be called by the framework when the job is requested to interrupt

public canInterruptBeforeStep(CSActiveScriptStep $oStep) : bool
Parameters
$oStep : CSActiveScriptStep

the current step to run

Tags
Return values
bool

true if the script can be interrupted, false if not at this step

checkInterruptionRequest()

Checks if an interruption request is being available for the current job. If so and the interruption is confirmed, the job gets interrupted.

public checkInterruptionRequest(mixed $oStep) : void
Parameters
$oStep : mixed
Tags
access

public

Return values
void

getAlternativePluginFolder()

public static getAlternativePluginFolder() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

getAvailableSleepDurationsPerStep()

Allows the plugin to provide a list of predefined numbers of microseconds the script should be able to sleep between each step.

public getAvailableSleepDurationsPerStep() : array<string|int, int>

The administrator of the script should be able to choose from this list. The value 0 will automatically be added to the list and is also the default.

Tags
Return values
array<string|int, int>

array with milliseconds like array(25, 50, 100, 250, 500) or single int like 1000 or string[] as associative array with the seconds to sleep as value and an optional explanation as key e.g. array('Slow' => 1000, 'Normal' => 500, 'Fast' => 100)

getIcon()

public getIcon() : string
Tags
Return values
string

the icon representation of the script as relative URL

getLevel()

The getLevel method may be overwritten in the plugins and defines the order, the plugins are called, where the highest level is called first.

public getLevel() : int

The method can also be set for all plugins within a module by overwriting the modules getLevel method.

Tags
Return values
int

the level of the plugin where it is called

getMetaData()

Returns the CSMetaData of the current plugin.

public getMetaData() : CSMetaData
Tags
access

public

Return values
CSMetaData

getModule()

Returns the module, if the plugin is defined within a module.

public getModule() : CSModule

This method can be used in the plugin api and the plugin wherever access to the defining module is required. If it is used in the Api, it should be noticed that this method may return null, if the plugin is directly defined in the projects or admin.local plugins directory.

Tags
Return values
CSModule

the module object, if the plugin defined in a module or null otherwise

getOutputKeys()

Lets a plugin developer tell which output his script will provide

public getOutputKeys() : array<string|int, string>
Tags
Return values
array<string|int, string>

array with the allowed output keys

getPlugin()

Returns a CSPlugin for the given plugin type and plugin class name.

public static getPlugin(string $pluginApiPath, string $className[, mixed $arguments = NULL ]) : CSPlugin|null

As standard behaviour the module subfolder is guessed from the forward URL parameter. If a plugin should point to something in a special module subfolder, this scope can be added by adding the module name in squared bracket at the end of the $pluginApiPath, e.g. 'core/api/plugins/CSRecordPlugin.php[pms]' to get all CSRecordPlugins defined for pms records.

Parameters
$pluginApiPath : string

The relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).

$className : string

The target plugin class name, which should be loaded.

$arguments : mixed = NULL

one or multiple arguments which should be passed to the isAvailable method.

Tags
Return values
CSPlugin|null

Returns the requested plugin for the given parameter.

getPluginChooser()

Returns an array all defined CSPlugins for the current plugin type

public static getPluginChooser(string $pluginApiPath[, mixed $arguments = NULL ]) : array<string|int, mixed>
Parameters
$pluginApiPath : string

the relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).

$arguments : mixed = NULL

one ore multiple arguments which should be passed to the isAvailable method.

Tags
Return values
array<string|int, mixed>

of CSPlugins in the form [CLASSNAME => LABEL] where the CLASSNAME may be used in the CSPlugin::getPlugin method

getPluginData()

public getPluginData() : mixed
Tags
Return values
mixed

getPluginDefinitionFile()

Returns the path to the file, the plugin is defined.

public getPluginDefinitionFile() : string
Tags
Return values
string

the path to the plugin

getPluginName()

Defines how the plugin will show up in the script plugin dropdown

public getPluginName() : string
Tags
Return values
string

the name of the plugin

getPlugins()

Returns all defined CSPlugins for the current plugin type It should be used to get all matching plugins for a given plugin api.

public static getPlugins(string $pluginApiPath[, mixed $arguments = NULL ]) : array<string|int, CSPlugin>

As standard behaviour the module subfolder is guessed from the forward URL parameter. If a plugin should point to something in a special module subfolder, this scope can be added by adding the module name in squared bracket at the end of the $pluginApiPath, e.g. 'core/api/plugins/CSRecordPlugin.php[pms]' to get all CSRecordPlugins defined for pms records.

Parameters
$pluginApiPath : string

the relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).

$arguments : mixed = NULL

one ore multiple arguments which should be passed to the isAvailable method.

Tags
Return values
array<string|int, CSPlugin>

array of CSPlugin objects matching the defined plugin criteria

getPluginsInModule()

Returns all CSPlugins for the current plugin type which are defined within the given module It should be used to get all matching plugins for a given plugin api.

public static getPluginsInModule(string $moduleName, string $pluginApiPath[, mixed $sFileNamePattern = '' ][, mixed $arguments = NULL ]) : array<string|int, mixed>
Parameters
$moduleName : string

the module which should be searched for plugins

$pluginApiPath : string

the relative path in filesystem for the requested plugin api.

$sFileNamePattern : mixed = ''
$arguments : mixed = NULL

one ore multiple arguments which should be passed to the isAvailable method.

Tags
Return values
array<string|int, mixed>

of CSPlugin objects matching the defined plugin criterias

isAvailable()

This method is called to check, whether the plugin is available.

public isAvailable() : bool

If further arguments are added to the CSPlugin::getPlugins call, they are added as arguments to this method.

For simpler usage of the plugin concept: This method should be overwritten with the correct signature for a plugin call, if arguments are passed.

Tags
Return values
bool

whether the plugin is available for the given arguments

isAvailableForCurrentUser()

Tells if this script is available for the current user outside of the actual editor

public isAvailableForCurrentUser() : bool
Tags
Return values
bool

isReadyToRerun()

If a job is configured to be kept alive, this method is called after each iteration to check if the next iteration should be started. It should be overwritten on plugin side to do a check if new data is available to be processed by the job.

public isReadyToRerun() : bool
Tags
access

public

Return values
bool

True, if the next iteration can be started, otherwise false.

onAfterRunScript()

Will be called by the framework after the script was executed. Compared to the onBeforeRunSteps-method, when it is called, all other tasks are already finished.

public onAfterRunScript() : void
Tags
Return values
void

onBeforeAutomaticResume()

Will be called by the framework before a job is resumed after being stopped in an unusual way.

public onBeforeAutomaticResume(CSActiveScriptStepList $oStepList) : void
Parameters
$oStepList : CSActiveScriptStepList

the step list built up in the addSteps method.

Tags
Return values
void

onBeforeRunScript()

Will be called by the framework before the script is executed.

public onBeforeRunScript() : void
Tags
Return values
void

resetLoadedPlugins()

reset the internal plugins cache for loaded plugins

public static resetLoadedPlugins() : mixed
Tags
@return

void;

access

public

Return values
mixed

run()

This is the most important method to implement when defining your CSOpenSearch Here the search is executed and the found IDs will be added to the Response

public final run() : mixed
Tags
access

public

Return values
mixed

shouldBeKeptAlive()

Returns whether the job should be kept alive by the framework. Only CORE jobs are allowed to define itself as such.

public shouldBeKeptAlive() : bool
Tags
access

public

Return values
bool

True, if the job should be kept alive, otherwise false.

shouldBeSelectableInGui()

Tells if the plugin wishes to be selectable by a user in the script editor.

public shouldBeSelectableInGui() : bool

If not the plugin can only be assigned through the API to a script.

Tags
Return values
bool

if true the plugin is selectable.

shouldIgnoreExecutionFlag()

Function to validate if the execution should skip automation settings

public final shouldIgnoreExecutionFlag() : bool
Tags
Return values
bool

If the execution should ignore the automation settings

supportsAutomaticResume()

Tells if the plugin supports automatic resume in case the job has been stopped in an unusual way (like webserver crashes). In case it returns true the script will automatically be resumed when a webserver is started again and the script was running at the time it was stopped.

public supportsAutomaticResume() : bool

IMPORTANT: to be able to automatically resume, a script must take care of restoring pointers or other references in onBeforeAutomaticResume so no error occurs.

Tags
access

public

Return values
bool

true, if automatic resume is supported, otherwise false.


        

Search results