Start and EndActionExecute added/fixed/documented

This commit is contained in:
Mikael Nordfeldth 2015-02-27 12:11:43 +01:00
parent 1cc96cd334
commit f25e5e3860
4 changed files with 17 additions and 8 deletions

View File

@ -2,6 +2,13 @@ InitializePlugin: a chance to initialize a plugin in a complete environment
CleanupPlugin: a chance to cleanup a plugin at the end of a program
StartActionExecute: Right before the "prepare" call of the current Action
- $action: the current Action object
- &$args: array of arguments, referenced so you can modify the array
EndActionExecute: Right after the "handle" call of the current Action
- $action: the current Action object
StartPrimaryNav: Showing the primary nav menu
- $action: the current action

View File

@ -118,16 +118,18 @@ class Action extends HTMLOutputter // lawsuit
common_config_set('db', 'database', $mirror);
}
$status = $this->prepare($args);
if ($status) {
if (Event::handle('StartActionExecute', array($this, &$args))) {
$prepared = $this->prepare($args);
if ($prepared) {
$this->handle($args);
} else {
common_debug('Prepare failed for Action.');
}
}
$this->flush();
Event::handle('EndActionExecute', array($status, $this));
Event::handle('EndActionExecute', array($this));
}
/**

View File

@ -37,7 +37,7 @@ class CronishPlugin extends Plugin {
* When the page has finished rendering, let's do some cron jobs
* if we have the time.
*/
public function onEndActionExecute($status, Action $action)
public function onEndActionExecute(Action $action)
{
$cron = new Cronish();
$cron->callTimedEvents();

View File

@ -14,7 +14,7 @@ class OpportunisticQMPlugin extends Plugin {
* When the page has finished rendering, let's do some cron jobs
* if we have the time.
*/
public function onEndActionExecute($status, Action $action)
public function onEndActionExecute(Action $action)
{
if ($action instanceof RunqueueAction) {
return true;