Finished log configuration. All loggers are currentrly working

This commit is contained in:
Franck Allimant
2013-11-01 16:15:19 +01:00
parent 1dc6aa52cb
commit 2aefb87db7
58 changed files with 2236 additions and 1438 deletions

View File

@@ -60,13 +60,12 @@ class TheliaBundle extends Bundle
$container->addScope(new Scope('request'));
$container
->addCompilerPass(new TranslatorPass())
->addCompilerPass(new RegisterListenersPass())
->addCompilerPass(new RegisterParserPluginPass())
->addCompilerPass(new RegisterRouterPass())
->addCompilerPass(new RegisterCouponPass())
->addCompilerPass(new RegisterCouponConditionPass())
->addCompilerPass(new TranslatorPass())
;
}
}

View File

@@ -26,6 +26,7 @@ namespace Thelia\Core\Controller;
use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Psr\Log\LoggerInterface;
/**
* ControllerResolver that supports "a:b:c", "service:method" and class::method" notations in routes definition

View File

@@ -27,7 +27,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Core\HttpFoundation\Response;
use Symfony\Component\Routing\Router;
use Thelia\Core\Template\Exception\ResourceNotFoundException;
use Thelia\Core\Template\ParserInterface;

View File

@@ -0,0 +1,48 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\HttpFoundation;
use Symfony\Component\HttpFoundation\Response as BaseResponse;
use Thelia\Log\Tlog;
/**
* extends Thelia\Core\HttpFoundation\Response for adding some helpers
*
* Class Response
* @package Thelia\Core\HttpFoundation
* @author Franck Allimant <franck@cqfdev.fr>
*/
class Response extends BaseResponse
{
/**
* Allow Tlog to write log stuff in the fina content.
*
* @see \Thelia\Core\HttpFoundation\Response::sendContent()
*/
public function sendContent() {
Tlog::getInstance()->write($this->content);
parent::sendContent();
}
}

View File

@@ -97,4 +97,6 @@ final class AdminResources
const TAX = "admin.configuration.tax";
const TEMPLATE = "admin.configuration.template";
const SYSTEM_LOG = "admin.configuration.system-log";
}

View File

@@ -238,13 +238,13 @@ class DataAccessFunctions extends AbstractSmartyPlugin
public function ConfigDataAccess($params, $smarty)
{
if (false === array_key_exists("key", $params)) {
return null;
}
$key = $this->getParam($params, 'key', false);
$key = $params['key'];
if ($key === false) return null;
return ConfigQuery::read($key);
$default = $this->getParam($params, 'default', '');
return ConfigQuery::read($key, $default);
}
/**

View File

@@ -74,13 +74,18 @@ class FlashMessage extends AbstractSmartyPlugin
public function getFlashMessage($params, $content, \Smarty_Internal_Template $template, &$repeat)
{
if ($repeat) {
$key = $params['key'];
$flashBag = $this->request->getSession()->get('flashMessage');
$template->assign('value', $flashBag[$key]);
// Reset flash message (can be read once)
unset($flashBag[$key]);
$this->request->getSession()->set('flashMessage', $flashBag);
if (false !== $key = $this->getParam($params, 'key', false)) {
$flashBag = $this->request->getSession()->get('flashMessage');
$template->assign('value', $flashBag[$key]);
// Reset flash message (can be read once)
unset($flashBag[$key]);
$this->request->getSession()->set('flashMessage', $flashBag);
}
} else {
return $content;
}

View File

@@ -41,14 +41,16 @@ class Module extends AbstractSmartyPlugin
public function theliaModule($params, \Smarty_Internal_Template $template)
{
$content = null;
if (array_key_exists('location', $params)) {
$location = $params['location'];
if (false !== $location = $this->getParam($params, 'location', false)) {
$modules = ModuleQuery::getActivated();
foreach ($modules as $module) {
$file = THELIA_MODULE_DIR . "/". ucfirst($module->getCode()) . "/AdminIncludes/".$location.".html";
if(file_exists($file)) {
$file = sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, ucfirst($module->getCode()), $location);
if (file_exists($file)) {
$content .= file_get_contents($file);
}
}

View File

@@ -7,7 +7,7 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface;
use \Smarty;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\Template\ParserInterface;
use Thelia\Core\Template\Smarty\AbstractSmartyPlugin;
@@ -155,7 +155,7 @@ class SmartyParser extends Smarty implements ParserInterface
*
* set $content with the body of the response or the Response object directly
*
* @param string|Symfony\Component\HttpFoundation\Response $content
* @param string|Thelia\Core\HttpFoundation\Response $content
*/
public function setContent($content)
{

View File

@@ -69,7 +69,7 @@ class Thelia extends Kernel
protected function initPropel()
{
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) {
if (file_exists(THELIA_CONF_DIR . 'database.yml') === false) {
return ;
}
@@ -96,7 +96,7 @@ class Thelia extends Kernel
{
parent::boot();
if (file_exists(THELIA_ROOT . '/local/config/database.yml') === true) {
if (file_exists(THELIA_CONF_DIR . 'database.yml') === true) {
$this->getContainer()->get("event_dispatcher")->dispatch(TheliaEvents::BOOT);
}