From d49dd2a940acbe624c7eaad4d52c2763ece0db28 Mon Sep 17 00:00:00 2001 From: roly Date: Mon, 25 Nov 2013 17:42:49 -0400 Subject: [PATCH] =?UTF-8?q?BUG-13506=20Correcci=C3=B3n=20de=20formato?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gulliver/system/class.g.php | 2 +- gulliver/system/class.logger.php | 12 ++++++------ workflow/engine/classes/class.wsTools.php | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 05346a18b..3929e66c8 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5261,7 +5261,7 @@ class G $config = System::getSystemConfiguration(); G::LoadSystem('logger'); - $oLogger = logger::getSingleton($pathData, PATH_SEP, $file); + $oLogger =& Logger::getSingleton($pathData, PATH_SEP, $file); $oLogger->limitFile = $config['number_log_file']; $oLogger->limitSize = $config['size_log_file']; $oLogger->write($message); diff --git a/gulliver/system/class.logger.php b/gulliver/system/class.logger.php index 8827a6259..46cd0c43a 100644 --- a/gulliver/system/class.logger.php +++ b/gulliver/system/class.logger.php @@ -14,7 +14,7 @@ * @author Roly Rudy Gutierrez Pinto * @package gulliver.system */ -class logger +class Logger { public static $instance = null; @@ -31,10 +31,10 @@ class logger { $this->limitFile = 5; $this->limitSize = 1000000; - $filename = explode(".", $file); - if (isset($filename[0]) && isset($filename[1])) { - $this->fileName = $filename[0]; - $this->fileExtension = '.' . $filename[1]; + $filename = pathinfo($file); + if (isset($filename['filename']) && isset($filename['extension'])) { + $this->fileName = $filename['filename']; + $this->fileExtension = '.' . $filename['extension']; } else { $this->fileName = 'cron'; $this->fileExtension = '.log'; @@ -49,7 +49,7 @@ class logger public function getSingleton($pathData, $pathSep, $file = 'cron.log') { if (self::$instance == null) { - self::$instance = new logger($pathData, $pathSep, $file); + self::$instance = new Logger($pathData, $pathSep, $file); } return self::$instance; } diff --git a/workflow/engine/classes/class.wsTools.php b/workflow/engine/classes/class.wsTools.php index 2f771435d..1ca256a6d 100755 --- a/workflow/engine/classes/class.wsTools.php +++ b/workflow/engine/classes/class.wsTools.php @@ -1417,13 +1417,15 @@ class workspaceTools public function backupLogFiles() { + $config = System::getSystemConfiguration(); + clearstatcache(); $path = PATH_DATA . "log" . PATH_SEP; $filePath = $path . "cron.log"; if (file_exists($filePath)) { $size = filesize($filePath); - /* 5000000 -> approximately 5 megabytes */ - if ($size > 5000000) { + /* $config['size_log_file'] has the value 5000000 -> approximately 5 megabytes */ + if ($size > $config['size_log_file']) { rename($filePath, $filePath . ".bak"); } }