summaryrefslogtreecommitdiff
path: root/app/Subscriber/BootstrapSubscriber.php
blob: e399f688491b495b7caf5a5d2994461bb47eaedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

namespace Kanboard\Subscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class BootstrapSubscriber extends \Kanboard\Core\Base implements EventSubscriberInterface
{
    public static function getSubscribedEvents()
    {
        return array(
            'app.bootstrap' => array('setup', 0),
        );
    }

    public function setup()
    {
        $this->config->setupTranslations();
        $this->config->setupTimezone();
        $this->sessionStorage->hasSubtaskInProgress = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
    }

    public function __destruct()
    {
        if (DEBUG) {
            foreach ($this->db->getLogMessages() as $message) {
                $this->logger->debug($message);
            }

            $this->logger->debug('SQL_QUERIES={nb}', array('nb' => $this->container['db']->nbQueries));
            $this->logger->debug('RENDERING={time}', array('time' => microtime(true) - $this->request->getStartTime()));
            $this->logger->debug('MEMORY='.$this->helper->text->bytes(memory_get_usage()));
            $this->logger->debug('URI='.$this->request->getUri());
            $this->logger->debug('###############################################');
        }
    }
}