Commit 963b9837532fe28d2cbdfb94b315de6e55729d83

Authored by Mark Holtzhausen
1 parent 306cdda9

SysLog db configuration updates.

sql/mysql/install/data.sql
... ... @@ -162,7 +162,8 @@ INSERT INTO `config_groups` VALUES
162 162 (21, 'user_prefs', 'User Preferences', 'Configures user preferences.', 'General Settings'),
163 163 (22, 'webservice', 'Web Services', 'KnowledgeTree Web Service Interface configuration. Note that a number of KnowledgeTree Tools rely on this service.', 'Client Tools Settings'),
164 164 (23, 'ldapAuthentication', 'LDAP Authentication', 'Configures LDAP Authentication', 'General Settings'),
165   -(24, 'server', 'Server Settings', 'Configuration settings for the server', 'General Settings');
  165 +(24, 'server', 'Server Settings', 'Configuration settings for the server', 'General Settings'),
  166 +(25, 'explorerCPSettings', 'Explorer CP Settings', 'Configuration options for KnowledgeTree Explorer CP', 'Client Tools Settings');
166 167 /*!40000 ALTER TABLE `config_groups` ENABLE KEYS */;
167 168 UNLOCK TABLES;
168 169  
... ... @@ -291,7 +292,8 @@ INSERT INTO `config_settings` VALUES
291 292 (116, 'export', 'Use External Zip Binary', 'Utilises the external zip binary for compressing archives. The default is to use the PEAR archive class.', 'useBinary', 'default', 'true', 'boolean', NULL, 0),
292 293 (117, 'export', 'Use Bulk Download Queue', 'The bulk download can be large and can prevent normal browsing. The download queue performs the bulk downloads in the background.', 'useDownloadQueue', 'default', 'true', 'boolean', NULL, 1),
293 294 (118, 'urls', 'Internal Var Directory', 'The path to the internal var directory that must sit within the web root', 'internalVarDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 0),
294   -(119, 'externalBinary', 'convert', 'The path to the ImageMagick "convert" binary', 'convertPath', 'default', 'convert', 'string', NULL, 1);
  295 +(119, 'externalBinary', 'convert', 'The path to the ImageMagick "convert" binary', 'convertPath', 'default', 'convert', 'string', NULL, 1),
  296 +(120, 'explorerCPSettings', 'Debug Log Level', 'Set the level of debug information included in the server side log file', 'debugLevel', 'error', 'error', 'dropdown', 'a:1:{s:7:\"options\";a:3:{i:0;a:2:{s:5:\"value\";s:3:\"off\";s:5:\"label\";s:10:\"No Logging\";}i:1;a:2:{s:5:\"value\";s:5:\"error\";s:5:\"label\";s:18:\"Error Logging Only\";}i:2;a:2:{s:5:\"value\";s:5:\"debug\";s:5:\"label\";s:28:\"Error and Debug Info Logging\";}}}', 1);
295 297 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
296 298 UNLOCK TABLES;
297 299  
... ... @@ -1775,7 +1777,8 @@ INSERT INTO `upgrades` VALUES
1775 1777 (231,'sql*3.7.0.1*0*3.7.0.1/mime_extractors_reset.sql','Database upgrade to version 3.7.0.1: Mime extractors reset','2009-09-01 00:00:00',1,'upgrade*3.7.0.1*99*upgrade3.7.0.1'),
1776 1778 (232,'upgrade*3.7.0.1*99*upgrade3.7.0.1','Upgrade from version 3.6.3 to 3.7.0.1','2009-11-13 00:00:00',1,'upgrade*3.7.0.1*99*upgrade3.7.0.1'),
1777 1779 (233,'sql*3.7.0.2*0*3.7.0.2/processor_queue.sql','Database upgrade to version 3.7.0.1: Processor Queue','2009-09-01 00:00:00',1,'upgrade*3.7.0.2*99*upgrade3.7.0.2'),
1778   -(234,'upgrade*3.7.0.2*99*upgrade3.7.0.2','Upgrade from version 3.7.0.1 to 3.7.0.2','2009-11-19 00:00:00',1,'upgrade*3.7.0.2*99*upgrade3.7.0.2');
  1780 +(234,'upgrade*3.7.0.2*99*upgrade3.7.0.2','Upgrade from version 3.7.0.1 to 3.7.0.2','2009-11-19 00:00:00',1,'upgrade*3.7.0.2*99*upgrade3.7.0.2'),
  1781 +(233,'sql*3.7.0.3*0*3.7.0.3/clienttools_config.sql','Database upgrade to version 3.7.0.3: Clienttools Config','2009-12-10 00:00:00',1,'upgrade*3.7.0.3*99*upgrade3.7.0.3');
1779 1782 /*!40000 ALTER TABLE `upgrades` ENABLE KEYS */;
1780 1783 UNLOCK TABLES;
1781 1784  
... ...
sql/mysql/upgrade/3.7.0.3/data.sql renamed to sql/mysql/upgrade/3.7.0.3/clienttools_config.sql
webservice/clienttools/clienttools_syslog.php
1 1 <?php
2   -
  2 +class Clienttools_Syslog{
  3 + /** The default folder in which to put the log files **/
  4 + private static $logFolder='/var/log/';
  5 + private static $debugLogTemplate='[date] | [time] | INFO | [user] | [location] | [debug_message] | ([debug_data])';
  6 + private static $errorLogTemplate='[date] | [time] | ERROR | [user] | [location] | [error_type] | [error_code] | [error_message] | [trace_info]';
  7 +
  8 +
  9 + private static function parseTemplate($template=NULL,$data=NULL){
  10 + $ret=null;
  11 + if(is_array($data)){
  12 + $txs=array_keys($data);
  13 + $txd=array_values($data);
  14 + $ret=str_replace($txs,$txd,$template);
  15 + };
  16 + return $ret;
  17 + }
  18 +
  19 +
  20 + /**
  21 + * Return the calculated log file name
  22 + * @return void
  23 + */
  24 + private static function getLogFile(){
  25 + $fileName=self::$logFolder.'kt_clienttools_'.date('Y-m-d').'.log.txt';
  26 + return $fileName;
  27 + }
  28 +
  29 + /**
  30 + * Return a boolean indicating whether error logging should be done
  31 + * @return boolean
  32 + */
  33 + private static function doErrorLogging(){
  34 +// $GLOBALS['default']['debugLevel']; //Another less secure way of finding the configured debugLevel
  35 + return KTConfig::getSingleton()->get('explorerCPSettings/debugLevel')=='error' || self::doDebugLogging();
  36 + }
  37 +
  38 + /**
  39 + * Return a boolean indicating whether debug logging should be done
  40 + * @return boolean
  41 + */
  42 + private static function doDebugLogging(){
  43 + return KTConfig::getSingleton()->get('explorerCPSettings/debugLevel')=='debug';
  44 + }
  45 +
  46 + public static function logInfo(){
  47 +
  48 + }
  49 +
  50 + public static function logError(){
  51 +
  52 + }
  53 +}
3 54 ?>
4 55 \ No newline at end of file
... ...
webservice/clienttools/comms.php
... ... @@ -42,6 +42,7 @@ include_once(&#39;jsonWrapper.php&#39;);
42 42 include_once('ajaxhandler.php');
43 43 include_once('serviceHelper.php');
44 44 include_once('client_service.php');
  45 +include_once('clienttools_syslog.php');
45 46  
46 47 //Instantiate base classes
47 48 $KT = new KTAPI();
... ...