X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_configRegistry.inc;h=f895a3dac561ef9a0c1a8c04d3c426c7beb37f3c;hb=9566dc068208034acf0da2630a7efbb5a370f191;hp=7b864e5b881aa4f72c06c0b48815ef8dbb79f43d;hpb=cd13cc0511736283fb27de647a22dfce0d3bff11;p=gosa.git diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc index 7b864e5b8..f895a3dac 100644 --- a/gosa-core/include/class_configRegistry.inc +++ b/gosa-core/include/class_configRegistry.inc @@ -57,6 +57,15 @@ class configRegistry{ $this->reload(); } + + /*! \brief Returns a list of plugins used by GOsa. + @return Array An array containing all plugins with theis plInfo data. + */ + function getListOfPlugins() + { + return($this->classesWithInfo); + } + /*! \brief Checks whether the schema check was called in the current session or not. * @return Boolean True if check was already called @@ -138,12 +147,26 @@ class configRegistry{ foreach($this->classesWithInfo as $cname => $defs){ if(isset($defs['plRequirements'])){ + // Check only if required plugin is enabled in gosa.conf + // Normally this is the class name itself, but may be overridden + // in plInfo using the plRequirements::activePlugin statement. + $requiresActivePlugin = $cname; + if(isset($defs['plRequirements']['activePlugin'])){ + $requiresActivePlugin = $defs['plRequirements']['activePlugin']; + } + // Only queue checks for active plugins. - if(isset($this->activePlugins[strtolower($cname)])){ + if(isset($this->activePlugins[strtolower($requiresActivePlugin)])){ $this->pluginRequirements[$cname] = $defs['plRequirements']; }else{ - new log("debug","","Skipped schema check for '{$cname}' plugin is inactive!", - array(),''); + if($cname == $requiresActivePlugin){ + new log("debug","","Skipped schema check for '{$cname}' plugin is inactive!", + array(),''); + }else{ + new log("debug","","Skipped schema check for class '{$cname}' skipped,". + " required plugin '{$requiresActivePlugin}' is inactive!", + array(),''); + } } } } @@ -374,7 +397,6 @@ class configRegistry{ $this->ldapStoredProperties[$class][$name] = $value; } } - $this->status = 'finished'; } // Register plugin properties. @@ -393,6 +415,12 @@ class configRegistry{ $this->register($cname, $data); $data = array('name' => 'postmodify','type' => 'command'); $this->register($cname, $data); + $data = array('name' => 'precreate','type' => 'command'); + $this->register($cname, $data); + $data = array('name' => 'preremove','type' => 'command'); + $this->register($cname, $data); + $data = array('name' => 'premodify','type' => 'command'); + $this->register($cname, $data); $data = array('name' => 'check', 'type' => 'command'); $this->register($cname, $data); @@ -403,6 +431,19 @@ class configRegistry{ } } } + + // We are only finsihed once we are logged in. + if(!empty($this->config->current['CONFIG'])){ + $this->status = 'finished'; + } + } + + + /*! \brief Returns TRUE if the property registration has finished without any error. + */ + function propertyInitializationComplete() + { + return($this->status == 'finished'); } @@ -702,6 +743,31 @@ class gosaProperty return($match); } + static function isWriteableFile($message,$class,$name,$value, $type) + { + $match = (file_exists($value) && is_writeable($value)) || + (!file_exists($value) && is_writeable(dirname($value))); + + + // Display the reason for failing this check. + if($message && ! $match){ + + if(!file_exists($value) && !is_writeable(dirname($value))){ + msg_dialog::display(_("Warning"), + sprintf(_("The file '%s' specified for '%s:%s' cannot be created neither be used for writing!"), + bold($value),bold($class),bold($name)), + WARNING_DIALOG); + }elseif(file_exists($value) && !is_writeable($value)){ + msg_dialog::display(_("Warning"), + sprintf(_("The file '%s' specified for '%s:%s' cannot be used for writing!"), + bold($value),bold($class),bold($name)), + WARNING_DIALOG); + } + } + + return($match); + } + static function isWriteablePath($message,$class,$name,$value, $type) { $match = !empty($value)&&is_dir($value)&&is_writeable($value);