ignore cache and log dir
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,3 +4,5 @@ local/config/build
|
||||
core/vendor
|
||||
local/config/runtime-conf.xml
|
||||
propel-gen
|
||||
cache/*
|
||||
log/*
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<?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\Database;
|
||||
|
||||
use Thelia\Log\TlogInterface;
|
||||
use Thelia\Database\NotORM\Result;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class Thelia\Database\NotORM extending \NotORM library http://www.notorm.com/
|
||||
*
|
||||
* This class create or redifine some setters
|
||||
*
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class NotORM extends \NotORM
|
||||
{
|
||||
|
||||
public $logger = false;
|
||||
|
||||
public function setCache(\NotORM_Cache $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
public function setLogger(TlogInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
public function setDebug($debug)
|
||||
{
|
||||
if (is_callable($debug)) {
|
||||
$this->debug = $debug;
|
||||
} else {
|
||||
$this->debug = true;
|
||||
}
|
||||
}
|
||||
|
||||
public function getStructure()
|
||||
{
|
||||
return $this->structure;
|
||||
}
|
||||
|
||||
/** Get table data
|
||||
* @param string
|
||||
* @param array (["condition"[, array("value")]]) passed to NotORM_Result::where()
|
||||
* @return NotORM_Result
|
||||
*/
|
||||
public function __call($table, array $where)
|
||||
{
|
||||
$return = new Result($this->structure->getReferencingTable($table, ''), $this);
|
||||
if ($where) {
|
||||
call_user_func_array(array($return, 'where'), $where);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Thelia\Database\NotORM;
|
||||
|
||||
class Result extends \NotORM_Result
|
||||
{
|
||||
protected function query($query, $parameters)
|
||||
{
|
||||
if ($this->notORM->debug) {
|
||||
if (!is_callable($this->notORM->debug)) {
|
||||
$debug = "$query;";
|
||||
if ($parameters) {
|
||||
$debug .= " -- " . implode(", ", array_map(array($this, 'quote'), $parameters));
|
||||
}
|
||||
$pattern = '(^' . preg_quote(dirname(__FILE__)) . '(\\.php$|[/\\\\]))'; // can be static
|
||||
foreach (debug_backtrace() as $backtrace) {
|
||||
if (isset($backtrace["file"]) && !preg_match($pattern, $backtrace["file"])) { // stop on first file outside NotORM source codes
|
||||
break;
|
||||
}
|
||||
}
|
||||
fwrite(STDERR, "$backtrace[file]:$backtrace[line]:$debug\n");
|
||||
} elseif (call_user_func($this->notORM->debug, $query, $parameters) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->notORM->logger !== false) {
|
||||
$this->notORM->logger->debug($query);
|
||||
$this->notORM->logger->debug($parameters);
|
||||
}
|
||||
$return = $this->notORM->connection->prepare($query);
|
||||
if (!$return || !$return->execute(array_map(array($this, 'formatValue'), $parameters))) {
|
||||
$this->notORM->logger->fatal("Error for this query : ".$query);
|
||||
$this->notORM->logger->fatal($this->notORM->errorCode());
|
||||
$this->notORM->logger->fatal(print_r($this->notORM->errorInfo(), true));
|
||||
$this->notORM->logger->fatal(print_r($return->errorInfo(), true));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user