Describe "cronRun" event in Events class

This commit is contained in:
Dmitriy Simushev 2014-10-17 14:42:39 +00:00
parent de1d5d6d51
commit 55b1476139
2 changed files with 12 additions and 1 deletions

View File

@ -20,6 +20,7 @@
namespace Mibew\Controller;
use Mibew\EventDispatcher\EventDispatcher;
use Mibew\EventDispatcher\Events;
use Mibew\Settings;
use Symfony\Component\HttpFoundation\Request;
@ -31,6 +32,8 @@ class CronController extends AbstractController
/**
* Runs the cron.
*
* Triggers {@link \Mibew\EventDispatcher\Events::CRON_RUN} event.
*
* @param Request $request Incoming request.
* @return string Rendered page content.
*/
@ -59,7 +62,7 @@ class CronController extends AbstractController
// Trigger cron event
$dispatcher = EventDispatcher::getInstance();
$dispatcher->triggerEvent('cronRun');
$dispatcher->triggerEvent(Events::CRON_RUN);
// Update time of last cron run
Settings::set('_last_cron_run', time());

View File

@ -24,6 +24,14 @@ namespace Mibew\EventDispatcher;
*/
final class Events
{
/**
* Cron is run.
*
* This event is triggered when cron is run. It provides an ability for
* plugins to perform custom maintenance actions.
*/
const CRON_RUN = 'cronRun';
/**
* An operator cannot be authenticated.
*