Code

Updated setup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Mar 2008 07:30:18 +0000 (07:30 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Mar 2008 07:30:18 +0000 (07:30 +0000)
-Added check for mbstring support
-Updated schema check

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@9333 594d385d-05f5-0310-b6e9-bd551577e9d8

setup/class_setupStep_Checks.inc
setup/class_setupStep_Schema.inc
setup/setup_schema.tpl

index 5af36b6c49080f15fe4c8198e598deaf3a50da23..402da6cbf69945ccd2177ec8c2de96ad8911cba1 100644 (file)
@@ -108,6 +108,14 @@ class Step_Checks extends setup_step
     $M = TRUE;
     $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
 
+    /* Is imap module available */
+    $N = _("Checking for multi byte support");
+    $D = _("The multi byte string support is required by some plugins.");
+    $S = _("Please compile php with enabled multi byte support '--enable-mbstring'.");
+    $R = is_callable("mb_strlen");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
     /* Check getacl in imap module */
     $N = _("Checking for getacl in IMAP implementation");
     $D = _("The getacl support is needed to handle shared folder permissions. Old IMAP extensions are not capable of reading acl's. You need a recent PHP version to use this feature.");
index 2008128a4253fb173439d7ec2ce69a83478e85ef..63b6ce47334cf95873ec544d325fce93d64cef5a 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,28 @@ 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 = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Check if root object exists */
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(objectClass=*)");
 
     $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);
@@ -91,9 +112,7 @@ class Step_Schema extends setup_step
     /* Get objectclasses */
     $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
     $objectclasses = $ldap->get_objectclasses();
-    if(count($objectclasses) == 0){
-      print_red(_("Can't get schema information from server. No schema check possible!"));
-    }
+    $this->found_ocs = count($objectclasses);
 
     /* Which samba version do we use? */
     if(isset($objectclasses['sambaSamAccount'])){
index e56538b1ec90b6f9b895b66381d85fd5f9393ae6..908b989b70d47db3906f14e2f8d645fdaedf951f 100644 (file)
                {else}
                        <img src='images/small_warning.png' class='center'>
                                <font style="color:red">{t}Schema check failed{/t}</font>
+
+
                {/if}
        </div>
        <div style="margin-left:20px;">
-               {foreach from=$checks item=val key=key}
-                               {if !$checks[$key].STATUS}
-                               <br>
-                                       {if $checks[$key].IS_MUST_HAVE}
-                                               <font color='red'>{$checks[$key].MSG}</font>
-                                       {else}
-                                               {$checks[$key].MSG}
+
+               {if $found_ocs == 0}
+                       <b>{t}Could not read any schema informations, all checks skipped. Adjust your ldap acls.{/t}</b>
+                       <br>
+                       {if !$database_initialised}
+                       <br>
+                               {t}It seems that your ldap database wasn't initialized yet. This maybe the reason, why GOsa can't read your schema configuration!{/t}
+                       {/if}
+               {else}
+                       {foreach from=$checks item=val key=key}
+                                       {if !$checks[$key].STATUS}
+                                       <br>
+                                               {if $checks[$key].IS_MUST_HAVE}
+                                                       <font color='red'>{$checks[$key].MSG}</font>
+                                               {else}
+                                                       {$checks[$key].MSG}
+                                               {/if}
+                                       <br>
                                        {/if}
-                               <br>
-                               {/if}
-               {/foreach}
+                       {/foreach}
+               {/if}
        </div>
 </div>
 <input type='hidden' value='1' name='step7_posted'>