Code

Made xml files readable again for posix/groupSelection dialog
[gosa.git] / gosa-core / setup / class_setupStep_Schema.inc
index ebf083a4563c8243b8dc9473cbcaeb7e6c571585..c4784593f6d927503cc4bad9b4534662807c0828 100644 (file)
@@ -29,6 +29,8 @@ class Step_Schema extends setup_step
   var $enable_schema_check = TRUE;
   var $samba_version       = 3;
 
+  var $found_ocs = 0; 
   function Step_Schema()
   {
     $this->update_strings();
@@ -58,9 +60,32 @@ class Step_Schema extends setup_step
     }else{
       $this->is_completed = TRUE;
     }
+    
+    /* Check if the database is already initialised.
+     * If the root object is missing we can't read any schema informations.
+     * In this case we should display a message.
+     */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap_l = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap = new ldapMultiplexer($ldap_l);
+
+    /* Check if root object exists */
+    $ldap->cd($cv['base']);
+    $ldap->set_size_limit(1);
+    $res = $ldap->search("(objectClass=*)");
+    $ldap->set_size_limit(0);
 
     $smarty = get_smarty();
     $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    $smarty->assign("database_initialised", ($res == TRUE));
+    $smarty->assign("found_ocs", $this->found_ocs);
     $smarty->assign("schema_readable",$this->schema_readable);
     $smarty->assign("enable_schema_check",$this->enable_schema_check);
     $smarty->assign("checks",$this->checked);
@@ -85,15 +110,13 @@ class Step_Schema extends setup_step
   function check_schema()
   {
     $cfg = $this->parent->captured_values;
-    $rfc2307bis = $cfg['rfc2307bis'];
-    $this->checked = check_schema($cfg,$rfc2307bis);
 
     /* Get objectclasses */
     $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
-    $objectclasses = $ldap->get_objectclasses();
-    if(count($objectclasses) == 0){
-      msg_dialog::display(_("LDAP error"), _("Cannot detect information about the installed LDAP schema!"), ERROR_DIALOG);
-    }
+    $objectclasses = $ldap->get_objectclasses(TRUE);
+    $this->found_ocs = count($objectclasses);
+    $rfc2307bis = $cfg['rfc2307bis'];
+    $this->checked = check_schema($cfg,$rfc2307bis);
 
     /* Which samba version do we use? */
     if(isset($objectclasses['sambaSamAccount'])){