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 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 StartPrimaryNav: Showing the primary nav menu
- $action: the current action - $action: the current action

View File

@ -118,16 +118,18 @@ class Action extends HTMLOutputter // lawsuit
common_config_set('db', 'database', $mirror); common_config_set('db', 'database', $mirror);
} }
$status = $this->prepare($args); if (Event::handle('StartActionExecute', array($this, &$args))) {
if ($status) { $prepared = $this->prepare($args);
$this->handle($args); if ($prepared) {
} else { $this->handle($args);
common_debug('Prepare failed for Action.'); } else {
common_debug('Prepare failed for Action.');
}
} }
$this->flush(); $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 * When the page has finished rendering, let's do some cron jobs
* if we have the time. * if we have the time.
*/ */
public function onEndActionExecute($status, Action $action) public function onEndActionExecute(Action $action)
{ {
$cron = new Cronish(); $cron = new Cronish();
$cron->callTimedEvents(); $cron->callTimedEvents();

View File

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