diff options
| author | Frederic Guillot <fred@kanboard.net> | 2016-01-16 21:06:36 -0500 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2016-01-16 21:06:36 -0500 |
| commit | 6a7b8ec60f265413ca88878dba6180456257d370 (patch) | |
| tree | 5b36bf3122d6884cb09b66e623e28768e92ed9ba /app/Subscriber/ProjectDailySummarySubscriber.php | |
| parent | 6a0895ef765ea7b83df02bb9789fda7415dee9a5 (diff) | |
Make sure that some event subscribers are not executed multiple times
Diffstat (limited to 'app/Subscriber/ProjectDailySummarySubscriber.php')
| -rw-r--r-- | app/Subscriber/ProjectDailySummarySubscriber.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/app/Subscriber/ProjectDailySummarySubscriber.php b/app/Subscriber/ProjectDailySummarySubscriber.php index d9239264..b70eaf71 100644 --- a/app/Subscriber/ProjectDailySummarySubscriber.php +++ b/app/Subscriber/ProjectDailySummarySubscriber.php @@ -6,22 +6,23 @@ use Kanboard\Event\TaskEvent; use Kanboard\Model\Task; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -class ProjectDailySummarySubscriber extends \Kanboard\Core\Base implements EventSubscriberInterface +class ProjectDailySummarySubscriber extends BaseSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { return array( - Task::EVENT_CREATE_UPDATE => array('execute', 0), - Task::EVENT_CLOSE => array('execute', 0), - Task::EVENT_OPEN => array('execute', 0), - Task::EVENT_MOVE_COLUMN => array('execute', 0), - Task::EVENT_MOVE_SWIMLANE => array('execute', 0), + Task::EVENT_CREATE_UPDATE => 'execute', + Task::EVENT_CLOSE => 'execute', + Task::EVENT_OPEN => 'execute', + Task::EVENT_MOVE_COLUMN => 'execute', + Task::EVENT_MOVE_SWIMLANE => 'execute', ); } public function execute(TaskEvent $event) { - if (isset($event['project_id'])) { + if (isset($event['project_id']) && !$this->isExecuted()) { + $this->logger->debug('Subscriber executed: '.__CLASS__.'::'.__METHOD__); $this->projectDailyColumnStats->updateTotals($event['project_id'], date('Y-m-d')); $this->projectDailyStats->updateTotals($event['project_id'], date('Y-m-d')); } |
