From: hickert Date: Tue, 13 Sep 2005 05:57:44 +0000 (+0000) Subject: Added mysql_persistent connections, and missing mysql_close () X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=513518cdfce4dc5fd7ed4fa41e398d2dbe5cfaa0;p=gosa.git Added mysql_persistent connections, and missing mysql_close () git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1348 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/FAI/class_askClassName.inc b/plugins/admin/FAI/class_askClassName.inc index 7e0433bfb..65cce88d3 100644 --- a/plugins/admin/FAI/class_askClassName.inc +++ b/plugins/admin/FAI/class_askClassName.inc @@ -27,7 +27,7 @@ class askClassName extends plugin function execute() { /* Fill templating stuff */ - $smarty= get_smarty(); + $smarty = get_smarty(); $display= ""; /* The faifilter contais @@ -39,16 +39,17 @@ class askClassName extends plugin * With a second search detect all object that belong to the different ous. */ $ldap = $this->config->get_ldap_link(); - $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $faifilter['base'], array("cn","description","objectClass"),TRUE); - $used=array(); + $res = get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",FALSE, $faifilter['base'], array("cn","description","objectClass"),TRUE); + $used = array(); $delete = array(); foreach($res as $objecttypes){ $res2 = get_list2($this->ui->subtreeACL, "(objectClass=*)", FALSE, $objecttypes['dn'], array("cn","description","objectClass","FAIclass"),TRUE); + foreach($res2 as $object){ - - /* skip class names with this type of object */ + + /* skip class names with this name */ if(in_array($this->objectClass,$object['objectClass'])){ $delete[] = $object['cn'][0]; } @@ -85,8 +86,8 @@ class askClassName extends plugin unset($used[$del]); } - /* if there is no class name which is missing the type - * of objectClass wew want to create now, disable selectBox + /* if there is no class name which is missing for this type + * of objectClass, we only can create a new one, disable selectBox */ if(count ($used)==0){ $smarty->assign("ClassNamesAvailable", " disabled "); @@ -116,7 +117,6 @@ class askClassName extends plugin /* Check given class name - * A class name For each object type, */ function check() { diff --git a/plugins/admin/FAI/class_faiHook.inc b/plugins/admin/FAI/class_faiHook.inc index 662f837e1..5aa6423b8 100644 --- a/plugins/admin/FAI/class_faiHook.inc +++ b/plugins/admin/FAI/class_faiHook.inc @@ -41,7 +41,6 @@ class faiHook extends plugin /* If "dn==new" we try to create a new entry * Else we must read all objects from ldap which belong to this entry. - * First read SubObjects from ldap ... and then the partition definitions for the SubObjects. */ if($dn != "new"){ $this->dn =$dn; @@ -103,15 +102,25 @@ class faiHook extends plugin /* Save Dialog */ if(isset($_POST['SaveSubObject'])){ + + /* Perform post check*/ $this->dialog->save_object(); + + /* Get messages */ $msgs = $this->dialog->check(); + + /* print errors */ if(count($msgs)>0){ foreach($msgs as $msg){ print_red($msg); } }else{ + + /* Get return object */ $obj = $this->dialog->save(); if(isset($obj['remove'])){ + + /* Depending on status, set new status */ if($this->SubObjects[$obj['remove']['from']]['status']=="edited"){ $this->SubObjects[$obj['remove']['from']]['status'] = "delete"; }elseif($this->SubObjects[$obj['remove']['from']]['status']=="new"){ diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index c5fb59f7e..058cddade 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -480,6 +480,7 @@ class phonequeue extends plugin } } + @mysql_close($r_con); return(false); } diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc index 5b77b0075..fe485e2a9 100644 --- a/plugins/admin/users/class_userManagement.inc +++ b/plugins/admin/users/class_userManagement.inc @@ -751,7 +751,7 @@ class userManagement extends plugin /* If you want to disable the status pictures, just comment out the next line */ - $r_con= @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + $r_con= @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); // Check if we are connected correctly if($r_con){ $r_db = @mysql_select_db($a_SETUP['DB'],$r_con); @@ -788,11 +788,14 @@ class userManagement extends plugin $fonac = preg_replace("/%title%/", $connected, $fonac); } } + mysql_close($r_con); } }else{ $fonac=$empty; } + + // Specify Pics for Extensions if(in_array("posixAccount" ,$val['objectClass'])){ $posix = preg_replace("/%KEY%/", "$key", $posiximg); diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index a119c495d..6d306b32b 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -219,7 +219,7 @@ class conference extends plugin $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; // Connect to DB server - $r_con = @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); // Check if we are connected correctly if(!$r_con){ @@ -317,7 +317,7 @@ class conference extends plugin } - + @mysql_close($r_con); return(true); } @@ -328,7 +328,7 @@ class conference extends plugin $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; // Connect to DB server - $r_con = @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); // Check if we are connected correctly if(!$r_con){ @@ -359,6 +359,7 @@ class conference extends plugin } }//ENDE old num availiable ... + @mysql_close($r_con); return(true); } diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 6ac7d11dc..a44a48995 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -174,7 +174,7 @@ class macro extends plugin $a_SETUP = $_SESSION['config']->data['SERVERS']['FON']; // Connect to DB server - $r_con = @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); // Check if we are connected correctly if(!$r_con){ @@ -285,9 +285,10 @@ class macro extends plugin } } } - - return true; - + if((isset($r_con))&&($r_con)){ + @mysql_close($r_con); + } + return true; } diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index 73b6d9db2..5b88dc733 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -219,7 +219,7 @@ class phoneAccount extends plugin */ // Connect to DB server if((isset($a_SETUP))&&(isset($a_SETUP['SERVER']))&&(isset($a_SETUP['LOGIN']))&&(isset($a_SETUP['PASSWORD']))){ - $r_con = @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); if($r_con){ $r_db = @mysql_select_db($a_SETUP['DB'],$r_con); $vp = mysql_fetch_row(mysql_query("SELECT ".$a_SETUP['VOICE_TABLE'].".password FROM ".$a_SETUP['VOICE_TABLE'].", ".$a_SETUP['SIP_TABLE']." WHERE customer_id = sip_users.mailbox AND name='".$this->uid."'")); @@ -227,8 +227,12 @@ class phoneAccount extends plugin if((isset($vp[0]))&&(!empty($vp[0]))){ $this->goFonPINVoice = $vp[0]; } + @mysql_close($r_con); } + } + + } @@ -266,7 +270,7 @@ class phoneAccount extends plugin // Connect to DB server - $r_con = @mysql_connect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); + $r_con = @mysql_pconnect($a_SETUP['SERVER'],$a_SETUP['LOGIN'],$a_SETUP['PASSWORD']); // Check if we are connected correctly if(!$r_con){ @@ -518,10 +522,12 @@ class phoneAccount extends plugin foreach($SQL as $query){ if(!@mysql_query($query,$r_con)){ print_red(_("Error while performing query ".mysql_error())); + @mysql_close($r_con); return false; } } } + @mysql_close($r_con); return true; } @@ -1030,6 +1036,7 @@ class phoneAccount extends plugin show_ldap_error($ldap->get_error()); /* Optionally execute a command after we're done */ + @mysql_close($r_con); $this->handle_post_events('remove'); }