Skip to content

Commit

Permalink
Improve memory consumption in devel environments: only execute DebugM…
Browse files Browse the repository at this point in the history
…ysql::setDebug when we are in debugMode = true
  • Loading branch information
Albert Garcia committed Sep 19, 2017
1 parent f1385ad commit e99ef7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Sifo/Debug/Mysql.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class DebugMysql extends Mysql
* Singleton static method. * Singleton static method.
* *
* @param string $profile The database server to connect to. * @param string $profile The database server to connect to.
* @return Db * @return DebugMysql
*/ */
static public function getInstance( $profile = 'default' ) static public function getInstance( $profile = 'default' )
{ {
Expand Down Expand Up @@ -277,6 +277,11 @@ public function __call( $method, $arguments )
*/ */
public static function setDebug( $statement, $query_time, $context, $resultset, $db_params, $pdo = null ) public static function setDebug( $statement, $query_time, $context, $resultset, $db_params, $pdo = null )
{ {
if (false == Domains::getInstance()->getDebugMode())
{
return;
}

if ( $resultset !== false ) if ( $resultset !== false )
{ {
$error = $resultset->errorInfo(); $error = $resultset->errorInfo();
Expand Down
2 changes: 1 addition & 1 deletion src/Sifo/Mysql.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function __construct( $profile )
* Singleton static method. * Singleton static method.
* *
* @param string $profile The database server to connect to. * @param string $profile The database server to connect to.
* @return Db * @return Mysql
*/ */
static public function getInstance( $profile = 'default' ) static public function getInstance( $profile = 'default' )
{ {
Expand Down

0 comments on commit e99ef7b

Please sign in to comment.