From: janw Date: Mon, 14 Apr 2008 10:35:17 +0000 (+0000) Subject: Added function 'is_provided'. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=24d411c316d4fd335b32220d586e5cf2b47109bb;p=gosa.git Added function 'is_provided'. Corrected dependency check. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10409 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/update-gosa b/gosa-core/update-gosa index def413976..76693ce92 100755 --- a/gosa-core/update-gosa +++ b/gosa-core/update-gosa @@ -255,9 +255,11 @@ function parse_ini($file) $plugin= &$tmp['gosa-plugin']; if (isset($plugin['name'])&& isset($plugin['description'])){ $res= $plugin['name']; - $provides[$res]= $plugin[$res]; $description[$res]= $plugin['description']; $versions[$res]= $plugin['version']; + if (isset($plugin['provides'])){ + $provides[$res]= explode(',', preg_replace('/\s+/', '', $plugin['provides'])); + } if (isset($plugin['depends'])){ $depends[$res]= explode(',', preg_replace('/\s+/', '', $plugin['depends'])); } @@ -278,7 +280,7 @@ function dependency_check() foreach ($depends as $name => $pl_depends){ foreach ($pl_depends as $pl){ - if (!in_array($pl, $provides)){ + if (!is_provided($pl, $provides)){ echo "! Error: plugin '$name' depends on '$pl' which is not provided by any plugin\n\n"; exit (1); } @@ -287,6 +289,22 @@ function dependency_check() } +function is_provided($dependency) +{ + global $provides; + + $result= FALSE; + foreach ($provides as $name => $pl_provides){ + if(in_array($dependency, $pl_provides)) { + $result= TRUE; + continue; + } + } + + return $result; +} + + function load_plugins() { if (!is_dir(PLUGSTATE_DIR)){