[PATCH 1/4] Modify log path/filename with global variable
David Durieux
d.durieux at siprossii.com
Fri Aug 20 19:37:20 UTC 2010
---
Classes/Action/InventoryAction.class.php | 2 +-
Classes/Action/PingAction.class.php | 2 +-
Classes/FusionLibServer.class.php | 2 +-
Classes/Logger.class.php | 11 +++++------
Classes/MyException.class.php | 2 +-
Classes/Storage/Inventory/DataFilter.class.php | 2 +-
.../Inventory/DirectoryStorageInventory.class.php | 2 +-
user/main.php | 3 +++
8 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/Classes/Action/InventoryAction.class.php b/Classes/Action/InventoryAction.class.php
index 6596d55..5bf5f04 100644
--- a/Classes/Action/InventoryAction.class.php
+++ b/Classes/Action/InventoryAction.class.php
@@ -89,7 +89,7 @@ class InventoryAction extends Action
*/
public function startAction($simpleXMLObj)
{
- $log = new Logger('logs');
+ $log = new Logger();
$libData = StorageInventoryFactory::createStorage($this->_applicationName, $this->_config, $simpleXMLObj);
diff --git a/Classes/Action/PingAction.class.php b/Classes/Action/PingAction.class.php
index 5d70a19..bd4334e 100644
--- a/Classes/Action/PingAction.class.php
+++ b/Classes/Action/PingAction.class.php
@@ -19,7 +19,7 @@ class PingAction extends Action
*/
public function startAction($simpleXMLObj)
{
- $log = new Logger('logs');
+ $log = new Logger();
$log->notifyDebugMessage("-- PING ACTION START --");
diff --git a/Classes/FusionLibServer.class.php b/Classes/FusionLibServer.class.php
index d2a45b6..e7ddb6e 100644
--- a/Classes/FusionLibServer.class.php
+++ b/Classes/FusionLibServer.class.php
@@ -84,7 +84,7 @@ class FusionLibServer
$simpleXMLObj = simplexml_load_string(@gzuncompress($GLOBALS["HTTP_RAW_POST_DATA"]));
//$simpleXMLObj = simplexml_load_file(dirname(__FILE__) ."/../data/aofr.ocs");
- $log = new Logger('logs');
+ $log = new Logger();
if($simpleXMLObj->QUERY == "PROLOG")
{
diff --git a/Classes/Logger.class.php b/Classes/Logger.class.php
index c702085..2236144 100644
--- a/Classes/Logger.class.php
+++ b/Classes/Logger.class.php
@@ -14,17 +14,16 @@ class Logger
private $_fileHandle;
- public function __construct($fileName)
+ public function __construct()
{
- $filePath = dirname(__FILE__)."/../data/logs/";
- if(!file_exists(dirname(__FILE__)."/../data/logs/"))
+ if(!file_exists(LIBSERVERFUSIONINVENTORY_LOG_FILE))
{
- mkdir(dirname(__FILE__)."/../data/logs/",0777,true);
+ mkdir(LIBSERVERFUSIONINVENTORY_LOG_FILE,0777,true);
}
- $this->_fileHandle = fopen($filePath.$fileName, "a");
+ $this->_fileHandle = fopen(LIBSERVERFUSIONINVENTORY_LOG_FILE, "a");
- if (!is_writable($filePath.$fileName))
+ if (!is_writable(LIBSERVERFUSIONINVENTORY_LOG_FILE))
{
throw new Exception("$filePath.$fileName isn't writable. Check permissions.");
}
diff --git a/Classes/MyException.class.php b/Classes/MyException.class.php
index 985bb7f..45d2e99 100644
--- a/Classes/MyException.class.php
+++ b/Classes/MyException.class.php
@@ -4,7 +4,7 @@ class MyException extends Exception
{
function __construct($msg)
{
- $log = new Logger('logs');
+ $log = new Logger();
$log->notifyExceptionMessage($msg);
parent::__construct($msg);
}
diff --git a/Classes/Storage/Inventory/DataFilter.class.php b/Classes/Storage/Inventory/DataFilter.class.php
index 41c5c38..cf2e6ef 100644
--- a/Classes/Storage/Inventory/DataFilter.class.php
+++ b/Classes/Storage/Inventory/DataFilter.class.php
@@ -14,7 +14,7 @@ class DataFilter
*/
public static function filter($section)
{
- $log = new Logger('logs');
+ $log = new Logger();
switch($section->getName())
{
case 'CONTROLLERS':
diff --git a/Classes/Storage/Inventory/DirectoryStorageInventory.class.php b/Classes/Storage/Inventory/DirectoryStorageInventory.class.php
index 2eb502c..8905cff 100644
--- a/Classes/Storage/Inventory/DirectoryStorageInventory.class.php
+++ b/Classes/Storage/Inventory/DirectoryStorageInventory.class.php
@@ -306,7 +306,7 @@ INFOCONTENT;
*/
public function updateLibMachine($xmlSections, $internalId)
{
- $log = new Logger('logs');
+ $log = new Logger();
// Retrieve all sections stored in info file
$iniSections = $this->_getINISections($internalId);
diff --git a/user/main.php b/user/main.php
index cd89583..2e202de 100644
--- a/user/main.php
+++ b/user/main.php
@@ -6,6 +6,9 @@ require_once dirname(__FILE__) ."/../Classes/Logger.class.php";
$configs = parse_ini_file(dirname(__FILE__) ."/configs.ini", true);
+define("LIBSERVERFUSIONINVENTORY_LOG_FILE",dirname(__FILE__)."/../data/logs");
+
+
if (file_exists ($path=dirname(__FILE__) ."/applications/{$configs['application']['name']}/FusInvHooks.class.php"))
{
require_once $path;
--
1.7.1
--MP_/588BW=eT46D5iQi6cnuB8Os
Content-Type: text/x-patch
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=0002-Add-Constant-for-Hools-classnma-because-program-usin.patch
More information about the Fusioninventory-devel
mailing list