summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd847b7)
raw | patch | inline | side by side (parent: dd847b7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 27 May 2010 16:21:31 +0000 (16:21 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 27 May 2010 16:21:31 +0000 (16:21 +0000) |
added comments to config registry
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18779 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18779 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/html/main.php | patch | blob | history | |
gosa-core/include/class_configRegistry.inc | patch | blob | history | |
gosa-core/setup/class_setupStep_Schema.inc | patch | blob | history |
index ec7b22390f1f43ae6a89b39cf18bcd0d395f3450..a801af37847b7076dd8080b65cd53aac11409833 100644 (file)
--- a/gosa-core/html/main.php
+++ b/gosa-core/html/main.php
if( $config->boolValueIsTrue('core','schemaCheck') &&
!$config->configRegistry->schemaCheckFinished() &&
!$config->configRegistry->validateSchemata($force=FALSE,$disableIncompatiblePlugins=TRUE)){
- $config->configRegistry->displayErrors();
+ $config->configRegistry->displayRequirementErrors();
}
/* Enable compressed output */
diff --git a/gosa-core/include/class_configRegistry.inc b/gosa-core/include/class_configRegistry.inc
index 2b593f0dfa47614f9fe96ef383f99673d2dbbabd..e4703b7d1579a562881ffedc91d46daf7be7ce32 100644 (file)
public $schemaCheckFinished = FALSE;
public $pluginsDeactivated = array();
+
+ /*! \brief Constructs the config registry
+ * @param config The configuration object
+ * @return
+ */
function __construct($config)
{
$this->config = &$config;
$this->reload();
}
-
+
+ /*! \brief Checks whether the schema check was called in the current session or not.
+ * @return Boolean True if check was already called
+ */
function schemaCheckFinished()
{
return($this->schemaCheckFinished);
}
-
- function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE)
+ /*! \brief Starts the schema validation
+ * @param Boolean 'force' Force a re-check.
+ * @param Boolean 'disableIncompatiblePlugins' Disables of incompatible GOsa-plugins.
+ * @return Boolean True on success else FALSE
+ */
+ function validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE, $objectClassesToUse = array())
{
// Read objectClasses from ldap
- if(!count($this->objectClasses)){
+ if(count($objectClassesToUse)){
+ $this->setObjectClasses($objectClassesToUse);
+ }elseif(!count($this->objectClasses)){
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
$this->setObjectClasses($ldap->get_objectclasses());
return($this->_validateSchemata($force, $disableIncompatiblePlugins));
}
+
+ /*! \brief Sets the list object classes to use while validation the schema. (See 'validateSchemata')
+ * This is called from the GOsa-Setup
+ * @param Array The list of object classes (usually LDAP::get_objectlclasses()).
+ * @return void
+ */
function setObjectClasses($ocs)
{
$this->objectClasses = $ocs;
}
+
+ /*! \brief Returns an array which contains all unresolved schemata requirements.
+ * @return Array An array containing all errors/issues
+ */
function getSchemaResults()
{
return($this->detectedSchemaIssues);
}
- function _validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE)
+
+ /*! \brief This method checks if the installed ldap-schemata matches the plugin requirements.
+ * @param Boolean 'force' Force a re-check.
+ * @param Boolean 'disableIncompatiblePlugins' Disables of incompatible GOsa-plugins.
+ * @return String
+ */
+ private function _validateSchemata($force = FALSE, $disableIncompatiblePlugins = FALSE)
{
// We cannot check without readable schema info
if(!count($this->objectClasses)){
}
+ /*! \brief The function 'validateSchemata' may has disabled some GOsa-Plugins,
+ * the list of disabled plugins will be returned here.
+ * @return Array The list of plugins disabled by 'validateSchemata'
+ */
function getDisabledPlugins()
{
return($this->pluginsDeactivated);
}
- function displayErrors()
+ /*! \brief Displays an error message with all issues detect during the schema validation.
+ */
+ function displayRequirementErrors()
{
-
$message = "";
if(count($this->detectedSchemaIssues['missing'])){
$message.= "<br>".
}
- function ocVersionMatch($required, $installed)
+ /*! \brief Checks to version strings (e.g. '>=v2.8' and '2.9')
+ * @param String The required version with operators (e.g. '>=2.8')
+ * @param String The version to match for withOUT operators (e.g. '2.9')
+ * @return Boolean True if version matches else false.
+ */
+ private function ocVersionMatch($required, $installed)
{
$operator = preg_replace('/^([=<>]*).*$/',"\\1",$required);
$required = preg_replace('/^[=<>]*(.*)$/',"\\1",$required);
}
+ /*! \brief Returns the currently installed version of a given object class.
+ * @param String The name of the objectClass to check for.
+ * @return String The version string of the objectClass (e.g. v2.7)
+ */
function getObjectClassVersion($oc)
{
if(!isset($this->objectClasses[$oc])){
}
- // check wheter an objectClass is installed or not.
+ /*! \brief Check whether the given object class is available or not.
+ * @param String The name of the objectClass to check for (e.g. 'mailAccount')
+ * @return Boolean Returns TRUE if the class exists else FALSE.
+ */
function ocAvailable($name)
{
return(isset($this->objectClasses[$name]));
}
+ /*! \brief Re-loads the list of installed GOsa-Properties.
+ * @param Boolean $force If force is TRUE, the complete properties list is rebuild..
+ */
function reload($force = FALSE)
{
// Do not reload the properties everytime, once we have
}
}
+
+ /*! \brief Registers a GOsa-Property and thus makes it useable by GOsa and its plugins.
+ * @param String $class The name of the class/plugin that wants to register this property.
+ * @return Array $data An array containing all data set in plInfo['plProperty]
+ */
function register($class,$data)
{
$id = count($this->properties);
$this->mapByName[$p] = $id;
}
+
+ /*! \brief Returns all registered properties.
+ * @return Array A list of all properties.
+ */
public function getAllProperties()
{
return($this->properties);
}
+
+ /*! \brief Checks whether a property exists or not.
+ * @param String $class The class name (e.g. 'core' or 'mailAccount')
+ * @param String $name The property name (e.g. 'sessionTimeout' or 'mailMethod')
+ * @return Boolean TRUE if it exists else FALSE.
+ */
function propertyExists($class,$name)
{
$p = strtolower("{$class}::{$name}");
return(isset($this->mapByName[$p]));
}
+
+ /*! \brief Returns the id of a registered property.
+ * @param String $class The class name (e.g. 'core' or 'mailAccount')
+ * @param String $name The property name (e.g. 'sessionTimeout' or 'mailMethod')
+ * @return Integer The id for the given property.
+ */
private function getId($class,$name)
{
$p = strtolower("{$class}::{$name}");
return($this->mapByName[$p]);
}
+
+ /*! \brief Returns a given property, if it exists.
+ * @param String $class The class name (e.g. 'core' or 'mailAccount')
+ * @param String $name The property name (e.g. 'sessionTimeout' or 'mailMethod')
+ * @return GOsaPropery The property or 'NULL' if it doesn't exists.
+ */
function getProperty($class,$name)
{
if($this->propertyExists($class,$name)){
return(NULL);
}
+
+ /*! \brief Returns the value for a given property, if it exists.
+ * @param String $class The class name (e.g. 'core' or 'mailAccount')
+ * @param String $name The property name (e.g. 'sessionTimeout' or 'mailMethod')
+ * @return GOsaPropery The property value or an empty string if it doesn't exists.
+ */
function getPropertyValue($class,$name)
{
if($this->propertyExists($class,$name)){
return("");
}
+
+ /*! \brief Set a new value for a given property, if it exists.
+ * @param String $class The class name (e.g. 'core' or 'mailAccount')
+ * @param String $name The property name (e.g. 'sessionTimeout' or 'mailMethod')
+ * @return
+ */
function setPropertyValue($class,$name, $value)
{
if($this->propertyExists($class,$name)){
return("");
}
+
+ /*! \brief Save all temporary made property changes and thus make them useable/effective.
+ * @return Array Returns a list of plugins that have to be migrated before they can be saved.
+ */
function saveChanges()
{
$migrate = array();
diff --git a/gosa-core/setup/class_setupStep_Schema.inc b/gosa-core/setup/class_setupStep_Schema.inc
index fc7fd84a990e15a66d669161ec394e6161e7db84..6353908c33d269ab427ac7c133b0a5d296d3e514 100644 (file)
// Validate schema
$cR = new configRegistry(NULL);;
- $cR->setObjectClasses($objectclasses);
- $cR->_validateSchemata(TRUE,TRUE);
+ $cR->validateSchemata(TRUE,TRUE,$objectclasses);
$info = $cR->getSchemaResults();
$disabled = $cR->getDisabledPlugins();