mvcDistributorPlugin

Base class providing shared logic for distributor plugins. Distributor plugins provide a means to hook in additional logic pre and post dispatch. The execute methods are all concrete so only the ones that need an implmentation need completing.

There are currently four events that can hooked into:

executeOnDispatcherInitialise This is executed during the distributors initialise phase. Any plugin that needs to be created or to modify the environment before the request is handled should implement this method.

For example: mvcDistributorPluginSession uses this hook so that the session is available before the request is dispatched. Similarly mvcDistributorPluginLog sets up per site logging.

executePreDispatch This is executed immediately before the controller is resolved and launched but afer the distributor is initialised. This hook is used by mvcDistributorPluginDispatchTimer to time how long the request takes to process.

executePostDispatch This is executed immediately after the controller has been launched but before the distributor has finished. This can be used to set-up information for the next request or to do immediate clean-up. mvcDistributorPluginDispatchTimer uses this hook to record the time taken by the request.

executeOnShutdown This is executed at the very end of the request as the distributor ends the request. It is used by mvcDistributorPluginMemTracker to track the total memory usage during the request.

Using Distributor Plugins

Plugins can be either expressly set by calling the registerPlugin method on mvcDistributorPluginSet (accessed via mvcDistributorBase::getPluginSet()) or via the sites config.xml file. If using the config file, then a new section called "distributorPlugins" should be added and then each plugin specified in the order they should be added. Note that some plugins may require others be loaded before they can be (e.g. detectDevice requires the session be ready).

// example load log and session in the site

Plugins are inherited through the site hierarchy. To disable a plugin create the section in the site and set the value to "false" or "0".


Methods

public __construct([$inMvcRequest = null])

Creates a new distributor plugin, requires request and the type of plugin

public reset()

Resets the object

public executeOnDispatcherInitialise()

Executes the plugin at dispatcher initialisation

public executePreDispatch()

Executes the plugin in pre-dispatch phase

public executePostDispatch()

Executes the plugin in post-dispatch phase

public executeOnShutdown()

Executes the plugin in shutdown phase

public getRequest()

Returns the current mvcRequest object

public setRequest($inRequest)

Set the mvcRequest instance

protected _getLogFolder()

Returns the log folder location for the current site

<  1  >