From 55b1476139982f5dc32856bb5f6d12665cbff8bc Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Fri, 17 Oct 2014 14:42:39 +0000 Subject: [PATCH] Describe "cronRun" event in Events class --- .../libs/classes/Mibew/Controller/CronController.php | 5 ++++- src/mibew/libs/classes/Mibew/EventDispatcher/Events.php | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mibew/libs/classes/Mibew/Controller/CronController.php b/src/mibew/libs/classes/Mibew/Controller/CronController.php index 21b923de..70b6ccc3 100644 --- a/src/mibew/libs/classes/Mibew/Controller/CronController.php +++ b/src/mibew/libs/classes/Mibew/Controller/CronController.php @@ -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()); diff --git a/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php b/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php index 7600e46c..713f710a 100644 --- a/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php +++ b/src/mibew/libs/classes/Mibew/EventDispatcher/Events.php @@ -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. *