summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 084a84e)
raw | patch | inline | side by side (parent: 084a84e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 8 Jan 2007 07:04:55 +0000 (07:04 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 8 Jan 2007 07:04:55 +0000 (07:04 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5472 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_servDB.inc | patch | blob | history |
index 1275580057ad572b3f278fbbe740a87c4e8fa361..4d99ad42ea1e7911c366516de74a9d20d1bfc0ee 100644 (file)
"goKrbAdmin", "goKrbPassword", "goFaxAdmin", "goFaxPassword",
"goLogAdmin", "goLogPassword", "goFonAdmin", "goFonPassword",
"goFonAreaCode", "goFonCountryCode","goGlpiAdmin","goGlpiDatabase","goGlpiPassword");
- var $objectclasses= array("top", "goServer");
+ var $objectclasses = array("top", "goServer");
+ var $init_objectclasses = array();
var $additionaloc= array("goImapServer" => array("goImapName", "goImapConnect",
"goImapAdmin", "goImapPassword",
"goImapSieveServer",
}
}
+ /* Remember used databases */
+ $this->init_objectclasses = $this->objectclasses;
+
/* We need to save the historical state of goImapName for later checking */
$this->goImapName_old= $this->goImapName;
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
/* Fill templating stuff */
$smarty= get_smarty();
}
}
}
+
+ /* Check if we are able to remove the asterisk database. If the database is still in use skip */
+ if (!in_array("goFonServer", $this->objectclasses) && in_array("goFonServer", $this->init_objectclasses)){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(&(goFonHomeServer=".$this->dn.")(|(uid=*)(cn=*)))",array("dn","uid","cn","goFonHomeServer"));
+ if($ldap->count()){
+
+ /* Number of entries shown in warning */
+ $i = 3;
+ $str = "";
+ while(($attrs = $ldap->fetch()) && $i >= 0){
+ $i --;
+ if(isset($attrs['uid'][0])){
+ $str .= $attrs['uid'][0]." ";
+ }else{
+ $str .= $attrs['cn'][0]." ";
+ }
+ }
+
+ /* Some entries found */
+ if($i != 3){
+ $message[] = sprintf(_("You can't remove the asterisk database extension, it is still in use by these objects '%s'."),trim($str));
+ }
+ }
+ }
+
if (in_array("goImapServer", $this->objectclasses) &&
$this->goImapName != $this->goImapName_old) {
// Attribute has changed
}
}
+ function allow_remove()
+ {
+ /* Check if we are able to remove the asterisk database. If the database is still in use skip */
+ if (in_array_ics("goFonServer", $this->init_objectclasses)){
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(&(goFonHomeServer=".$this->dn.")(|(uid=*)(cn=*)))",array("dn","uid","cn","goFonHomeServer"));
+ if($ldap->count()){
+
+ /* Number of entries shown in warning */
+ $i = 3;
+ $str = "";
+ while(($attrs = $ldap->fetch()) && $i >= 0){
+ $i --;
+ if(isset($attrs['uid'][0])){
+ $str .= $attrs['uid'][0]." ";
+ }else{
+ $str .= $attrs['cn'][0]." ";
+ }
+ }
+
+ /* Some entries found */
+ if($i != 3){
+ return(sprintf(_("You can't remove the asterisk database extension, it is still in use by these objects '%s'."),trim($str)));
+ }
+ }
+ }
+ }
+
+
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: