From: hickert Date: Thu, 14 Jun 2007 13:20:58 +0000 (+0000) Subject: Udpated Log and Copy&Paste X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fc44dae33071cec905b366610a5468809b09977b;p=gosa.git Udpated Log and Copy&Paste git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6594 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_CopyPasteHandler.inc b/include/class_CopyPasteHandler.inc index c11849e2f..2650fc9c9 100644 --- a/include/class_CopyPasteHandler.inc +++ b/include/class_CopyPasteHandler.inc @@ -80,6 +80,19 @@ class CopyPasteHandler { unset($this->queue[$key]); } + /* Create patch if it doesn't exists */ + if(!is_dir(LDAP_DUMP_PATH)){ + @mkdir(LDAP_DUMP_PATH); + } + + /* check if we are able to create a new file the given directory */ + if(!is_writeable(LDAP_DUMP_PATH)){ + print_red(sprintf(_("Could not cleanup copy & paste queue. We are not allowed to save ldap dump to '%s', please check permissions."),LDAP_DUMP_PATH)); + new log("copy","all/all","copy & paste, event queue.",array(), + sprintf("Could not cleanup copy & paste queue. We are not allowed to save ldap dump to '%s', please check permissions.",LDAP_DUMP_PATH)); + return(FALSE); + } + /* Remove entries from hdd that are older than24 hours */ $fp = opendir(LDAP_DUMP_PATH); while($file = readdir($fp)){ diff --git a/include/class_log.inc b/include/class_log.inc index de8154fe4..462be2892 100644 --- a/include/class_log.inc +++ b/include/class_log.inc @@ -45,6 +45,11 @@ class log { */ function log($action,$objecttype,$object,$changes_array = array(),$result = TRUE) { + if(!is_array($changes_array)){ + trigger_error("log(string,string,string,array(),bool). Forth parameter must be an array."); + $changes_array = array(); + } + $entry = array(); if(!isset($_SESSION['config'])){ $entry['user']= "unkown"; @@ -138,10 +143,10 @@ class log { } foreach($servers as $server_name => $server){ - - $con = mysql_pconnect($server_name,$server['USER'],$server['PWD']); + + $con = @mysql_pconnect($server_name,$server['USER'],$server['PWD']); if(!$con){ - print_red(sprintf(_("Could not connect to logging server %s."),$server['SERVER'])); + print_red(sprintf(_("Could not connect to logging server %s."),$server_name)); }else{ $db = mysql_select_db($server['DB'],$con); if(!$db){ @@ -168,6 +173,7 @@ class log { } } + mysql_close($con); } } }