CC-4275: Enable debug mode where all Propel queries are displayed in raw SQL
-add enablePropelLogging and disablePropelLogging functions
This commit is contained in:
parent
7cbe037c7e
commit
9893282e43
|
@ -14,18 +14,6 @@ require_once __DIR__."/configs/ACL.php";
|
|||
require_once 'propel/runtime/lib/Propel.php';
|
||||
|
||||
Propel::init(__DIR__."/configs/airtime-conf-production.php");
|
||||
if (defined('APPLICATION_ENV') && APPLICATION_ENV == "development") {
|
||||
$logger = Logging::getLogger();
|
||||
Propel::setLogger($logger);
|
||||
|
||||
$con = Propel::getConnection();
|
||||
$con->useDebug(true);
|
||||
|
||||
$config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
|
||||
$config->setParameter('debugpdo.logging.details.method.enabled', true);
|
||||
$config->setParameter('debugpdo.logging.details.time.enabled', true);
|
||||
$config->setParameter('debugpdo.logging.details.mem.enabled', true);
|
||||
}
|
||||
|
||||
require_once __DIR__."/configs/constants.php";
|
||||
require_once 'Preference.php';
|
||||
|
|
|
@ -69,4 +69,26 @@ class Logging {
|
|||
$logger->debug("[$file : $function() : line $line] - ".self::toString($p_msg));
|
||||
}
|
||||
}
|
||||
|
||||
public static function enablePropelLogging()
|
||||
{
|
||||
$logger = Logging::getLogger();
|
||||
Propel::setLogger($logger);
|
||||
|
||||
$con = Propel::getConnection();
|
||||
$con->useDebug(true);
|
||||
|
||||
$config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
|
||||
$config->setParameter('debugpdo.logging.details.method.enabled', true);
|
||||
$config->setParameter('debugpdo.logging.details.time.enabled', true);
|
||||
$config->setParameter('debugpdo.logging.details.mem.enabled', true);
|
||||
}
|
||||
|
||||
public static function disablePropelLogging()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$con->useDebug(false);
|
||||
Propel::setLogger(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -949,7 +949,8 @@ EOT;
|
|||
CcBlockQuery::create()->findPk($this->id)->setDbType($p_blockType)->save();
|
||||
}
|
||||
|
||||
public function setLength($value){
|
||||
public function setLength($value)
|
||||
{
|
||||
$this->block->setDbLength($value);
|
||||
$this->block->save($this->con);
|
||||
$this->updateBlockLengthInAllPlaylist();
|
||||
|
@ -998,7 +999,8 @@ EOT;
|
|||
}
|
||||
}
|
||||
|
||||
public function storeCriteriaIntoDb($p_criteriaData){
|
||||
public function storeCriteriaIntoDb($p_criteriaData)
|
||||
{
|
||||
// delete criteria under $p_blockId
|
||||
CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete();
|
||||
Logging::info($p_criteriaData);
|
||||
|
@ -1214,7 +1216,9 @@ EOT;
|
|||
$limits['time'] = 1440 * 60;
|
||||
$limits['items'] = $storedCrit['limit']['value'];
|
||||
} else {
|
||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ? intval(floatval($storedCrit['limit']['value']) * 60 * 60) : intval($storedCrit['limit']['value'] * 60);
|
||||
$limits['time'] = $storedCrit['limit']['modifier'] == "hours" ?
|
||||
intval(floatval($storedCrit['limit']['value']) * 60 * 60) :
|
||||
intval($storedCrit['limit']['value'] * 60);
|
||||
$limits['items'] = null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue