diff options
-rw-r--r-- | app/Auth/Base.php | 1 | ||||
-rw-r--r-- | app/Controller/Base.php | 8 | ||||
-rw-r--r-- | app/Controller/Project.php | 2 | ||||
-rw-r--r-- | app/ServiceProvider/DatabaseProvider.php | 1 | ||||
-rw-r--r-- | app/ServiceProvider/LoggingProvider.php | 7 | ||||
-rw-r--r-- | app/constants.php | 3 | ||||
-rw-r--r-- | composer.lock | 8 | ||||
-rw-r--r-- | config.default.php | 3 |
8 files changed, 23 insertions, 10 deletions
diff --git a/app/Auth/Base.php b/app/Auth/Base.php index 2a3bdce0..e023e4fe 100644 --- a/app/Auth/Base.php +++ b/app/Auth/Base.php @@ -13,6 +13,7 @@ use Pimple\Container; * @property \Model\Acl $acl * @property \Model\LastLogin $lastLogin * @property \Model\User $user + * @property \Model\UserSession $userSession */ abstract class Base { diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 4afcba37..cd807d56 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -100,9 +100,11 @@ abstract class Base */ public function __destruct() { - // foreach ($this->container['db']->getLogMessages() as $message) { - // $this->container['logger']->addDebug($message); - // } + if (DEBUG) { + foreach ($this->container['db']->getLogMessages() as $message) { + $this->container['logger']->addDebug($message); + } + } } /** diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 6079971a..95779154 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -574,7 +574,7 @@ class Project extends Base */ public function create(array $values = array(), array $errors = array()) { - $is_private = $this->request->getIntegerParam('private', ! $this->userSession->isAdmin()); + $is_private = $this->request->getIntegerParam('private', $this->userSession->isAdmin() ? 0 : 1); $this->response->html($this->template->layout('project/new', array( 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php index 2ed87ace..632b0238 100644 --- a/app/ServiceProvider/DatabaseProvider.php +++ b/app/ServiceProvider/DatabaseProvider.php @@ -11,6 +11,7 @@ class DatabaseProvider implements ServiceProviderInterface public function register(Container $container) { $container['db'] = $this->getInstance(); + $container['db']->stopwatch = DEBUG; } /** diff --git a/app/ServiceProvider/LoggingProvider.php b/app/ServiceProvider/LoggingProvider.php index 93f55a9c..f5e70381 100644 --- a/app/ServiceProvider/LoggingProvider.php +++ b/app/ServiceProvider/LoggingProvider.php @@ -13,8 +13,11 @@ class LoggingProvider implements ServiceProviderInterface public function register(Container $container) { $logger = new Logger('app'); - $logger->pushHandler(new StreamHandler(__DIR__.'/../../data/debug.log', Logger::DEBUG)); - $logger->pushHandler(new SyslogHandler('kanboard', LOG_USER, Logger::DEBUG)); + $logger->pushHandler(new SyslogHandler('kanboard', LOG_USER, Logger::INFO)); + + if (DEBUG) { + $logger->pushHandler(new StreamHandler(__DIR__.'/../../data/debug.log', Logger::DEBUG)); + } $container['logger'] = $logger; } diff --git a/app/constants.php b/app/constants.php index 08e10d68..a8d8f56e 100644 --- a/app/constants.php +++ b/app/constants.php @@ -1,5 +1,8 @@ <?php +// Enable/disable debug +defined('DEBUG') or define('DEBUG', false); + // Application version defined('APP_VERSION') or define('APP_VERSION', 'master'); diff --git a/composer.lock b/composer.lock index 7781803d..b68d1db1 100644 --- a/composer.lock +++ b/composer.lock @@ -88,12 +88,12 @@ "source": { "type": "git", "url": "https://github.com/fguillot/picoDb.git", - "reference": "5d1d8d6e898975fc30a241614d9bf06d5728db7d" + "reference": "682616b9accbfd719677ed0b3f478107cea2dacc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoDb/zipball/5d1d8d6e898975fc30a241614d9bf06d5728db7d", - "reference": "5d1d8d6e898975fc30a241614d9bf06d5728db7d", + "url": "https://api.github.com/repos/fguillot/picoDb/zipball/682616b9accbfd719677ed0b3f478107cea2dacc", + "reference": "682616b9accbfd719677ed0b3f478107cea2dacc", "shasum": "" }, "require": { @@ -117,7 +117,7 @@ ], "description": "Minimalist database query builder", "homepage": "https://github.com/fguillot/picoDb", - "time": "2014-12-26 17:10:34" + "time": "2014-12-31 17:44:58" }, { "name": "fguillot/simple-validator", diff --git a/config.default.php b/config.default.php index b9cbdf98..ed1d5fd8 100644 --- a/config.default.php +++ b/config.default.php @@ -1,5 +1,8 @@ <?php +// Enable/Disable debug +define('DEBUG', false); + // E-mail address for the "From" header (notifications) define('MAIL_FROM', 'notifications@kanboard.local'); |