Code

Added dependency check when removing a plugin
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Jan 2008 07:28:24 +0000 (07:28 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Jan 2008 07:28:24 +0000 (07:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8573 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/update-gosa

index de343937cd9aa74e1a39fdcfa2dfc2e90e383213..9d3b2738dfbb6e0f6a07b12f02af23a60f7def49 100755 (executable)
@@ -375,7 +375,7 @@ function install_plugin($file)
 
 function remove_plugin($name)
 {
-       global $description;
+       global $description, $depends;
 
        /* Load plugin list */
        load_plugins();
@@ -386,6 +386,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";