From: hickert Date: Tue, 15 May 2007 06:40:38 +0000 (+0000) Subject: Added Log to glpi extension X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=97372fed6af421a2b6295cf3bd73b39ae706df01;p=gosa.git Added Log to glpi extension git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6373 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc index 2e6f70298..be0a56012 100644 --- a/plugins/admin/systems/class_componentGeneric.inc +++ b/plugins/admin/systems/class_componentGeneric.inc @@ -37,6 +37,10 @@ class componentGeneric extends plugin $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses, true); /* Save dn for later references */ $this->orig_dn= $this->dn; + + if($this->is_account){ + @log::log("view","component/".get_class($this),$this->dn); + } } function execute() @@ -122,6 +126,9 @@ class componentGeneric extends plugin $ldap= $this->config->get_ldap_link(); $this->netConfigDNS->remove_from_parent(); $ldap->rmdir($this->dn); + + @log::log("remove","component/".get_class($this),$this->dn,$this->attributes,$ldap->get_error()); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system component/generic with dn '%s' failed."),$this->dn)); $this->handle_post_events("remove"); @@ -230,7 +237,9 @@ class componentGeneric extends plugin $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); $ldap->add($this->attrs); + @log::log("create","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("add"); + } else { if ($this->orig_dn != $this->dn){ $this->move($this->orig_dn, $this->dn); @@ -239,7 +248,7 @@ class componentGeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); - + @log::log("modify","component/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_glpiAccount.inc b/plugins/admin/systems/class_glpiAccount.inc index 12e677ba6..937323083 100644 --- a/plugins/admin/systems/class_glpiAccount.inc +++ b/plugins/admin/systems/class_glpiAccount.inc @@ -44,7 +44,7 @@ class glpiAccount extends plugin var $objectclasses= array("whatever"); /* Used to remember if this was an account (simply: is this an edited entry) */ - var $initialy_was_account = false; + var $initially_was_account = false; /* Remember current dialog */ var $edit_type = false; @@ -110,9 +110,11 @@ class glpiAccount extends plugin /* set defaults */ $this->name = $this->dn; $this->orig_dn = $this->dn; - $this->initialy_was_account = $this->is_account; - + $this->initially_was_account = $this->is_account; + if($this->is_account){ + @log::log("view","undefined/".get_class($this),$this->dn); + } } function execute() @@ -667,11 +669,13 @@ class glpiAccount extends plugin } if(function_exists("mysql_pconnect")){ $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']); - if($this->initialy_was_account){ + if($this->initially_was_account){ $this->handle->removeComputerInformations($this->dn); + @log::log("remove","undefined/".get_class($this),$this->dn); } }else{ print_red(_("Can't remove glpi account, while mysql extension is missing.")); + @log::log("remove","undefined/".get_class($this),$this->dn,array(),_("Can't remove glpi account, while mysql extension is missing.")); } } @@ -714,6 +718,7 @@ class glpiAccount extends plugin return ($message); } + /* Save to LDAP */ function save() { @@ -728,16 +733,19 @@ class glpiAccount extends plugin $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']); /* check if we have to update, add */ - if($this->initialy_was_account&&$this->is_account){ + if($this->initially_was_account&&$this->is_account){ $this->handle->updateComputerInformations($attrs,$this->orig_dn); + @log::log("modify","undefined/".get_class($this),$this->dn); }elseif($this->is_account){ $this->handle->addComputerInformations($attrs,$this->dn); + @log::log("create","undefined/".get_class($this),$this->dn); } $tmp = $this->handle->getComputerInformations($this->dn); $this->handle->addDevicesToComputer($this->usedDevices,$tmp[0]['ID']); } } + /* Return used attachments */ function getUsedAttachments($divlist = false) { diff --git a/plugins/admin/systems/class_glpiPrinterAccount.inc b/plugins/admin/systems/class_glpiPrinterAccount.inc index 68232a832..fb8ce7e49 100644 --- a/plugins/admin/systems/class_glpiPrinterAccount.inc +++ b/plugins/admin/systems/class_glpiPrinterAccount.inc @@ -125,6 +125,10 @@ class glpiPrinterAccount extends plugin $this->name = $this->dn; $this->orig_dn = $this->dn; $this->initially_was_account = $this->is_account; + + if($this->is_account){ + @log::log("view","printer/".get_class($this),$this->dn); + } } function execute() @@ -648,7 +652,8 @@ class glpiPrinterAccount extends plugin { $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']); if($this->initially_was_account){ - $this->handle->removePrinterInformations($this->dn); + $this->handle->removePrinterInformations($this->dn); + @log::log("remove","printer/".get_class($this),$this->dn); } } @@ -709,8 +714,10 @@ class glpiPrinterAccount extends plugin $this->handle = new glpiDB($this->data['SERVER'],$this->data['LOGIN'],$this->data['PASSWORD'],$this->data['DB']); if($this->initially_was_account&&$this->is_account){ $this->handle->updatePrinterInformations($attrs,$this->dn); + @log::log("modify","printer/".get_class($this),$this->dn); }elseif($this->is_account){ $this->handle->addPrinterInformations($attrs,$this->dn); + @log::log("create","printer/".get_class($this),$this->dn); } $tmp = $this->handle->getPrinterInformations($this->dn); $this->handle->addAttachmentsToPrinter($this->usedAttachments,$tmp[0]['ID']);