Code

Unified two messages
[gosa.git] / gosa-core / update-gosa
index de343937cd9aa74e1a39fdcfa2dfc2e90e383213..186947d5afd344da366bd9848bf60c923afd40c9 100755 (executable)
@@ -290,7 +290,14 @@ function install_plugin($file)
 
                                /* Check if dependencies are fullfilled */
                                foreach ($depends as $dep){
-                                       if (!in_array($dep, $provides)){
+                                       $found= false;
+                                       foreach ($provides as $provide => $dummy){
+                                               if ($dep == $provide){
+                                                       $found= true;
+                                                       break;
+                                               }
+                                       }
+                                       if (!$found){
                                                echo "! Error: plugin depends on '$dep', but this is not installed\n\n";
                                                exit (3);
                                        }
@@ -375,7 +382,7 @@ function install_plugin($file)
 
 function remove_plugin($name)
 {
-       global $description;
+       global $description, $depends;
 
        /* Load plugin list */
        load_plugins();
@@ -386,6 +393,14 @@ function remove_plugin($name)
                exit (1);
        }
 
+       /* Depends? */
+       foreach ($depends as $sname => $pl_depends){
+               if (in_array($name, $pl_depends)){
+                       echo "! Error: plugin '$sname' depends on '$name' - cannot remove it\n\n";
+                       exit (1);
+               }
+       }
+
        /* Load information */
        if (!file_exists(PLUGSTATE_DIR."/$name/plugin.lst")){
                echo "! Error: cannot remove plugin '$name' - no install history found\n\n";