From b3ec51812fd2325e6e9a0f3acad08935ff876deb Mon Sep 17 00:00:00 2001 From: cajus Date: Mon, 21 Jan 2008 14:43:47 +0000 Subject: [PATCH] Removed update-gosa git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8521 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/re-generate-mo-will-move | 204 ++++++++++++++++++++++++++++- gosa-core/update-gosa | 97 -------------- 2 files changed, 201 insertions(+), 100 deletions(-) delete mode 100755 gosa-core/update-gosa diff --git a/gosa-core/re-generate-mo-will-move b/gosa-core/re-generate-mo-will-move index 4c614f9ff..cf51485e9 100755 --- a/gosa-core/re-generate-mo-will-move +++ b/gosa-core/re-generate-mo-will-move @@ -2,6 +2,7 @@ $value){ + fwrite ($handle, " \"$key\" => \"$value\",\n"); + } + fwrite ($handle, " );\n?>"); + + fclose($handle); +} + + function rescan_i18n() { $languages= array(); @@ -66,16 +151,126 @@ function rescan_i18n() } +function parse_ini($file) +{ + global $description, $provides, $depends; + + $res= ""; + if (file_exists($file)){ + $tmp= parse_ini_file($file, TRUE); + + if (isset($tmp['gosa-plugin'])){ + $plugin= &$tmp['gosa-plugin']; + if (isset($plugin['name'])&& isset($plugin['description']) && isset($plugin['provides'])){ + $res= $plugin['name']; + $provides[$res]= $plugin['provides']; + $description[$res]= $plugin['description']; + if (isset($plugin['depends'])){ + $depends[$res]= explode(',', preg_replace('/\s+/', '', $plugin['depends'])); + } + } + } + } + + return $res; +} + + +function dependency_check() +{ + global $description, $provides, $depends; + + foreach ($depends as $name => $pl_depends){ + foreach ($pl_depends as $pl){ + if (!in_array($pl, $provides)){ + echo "! Error: plugin '$name' depends on '$pl' which is not provided by any plugin\n\n"; + exit (1); + } + } + } +} + + +function load_plugins() +{ + $dir= new DirectoryIterator(PLUGSTATE_DIR); + foreach ($dir as $entry){ + if ($dir->isDir() && !preg_match('/^\./', $dir->__toString())){ + $file= $dir->getPathName()."/plugin.dsc"; + if (!parse_ini($file)){ + echo "! Warning: plugin ".$dir->getPathName()." is missing declarations\n"; + } + } + } +} + + +function list_plugins() +{ + global $description; + $count= 0; + + /* Load plugin list */ + load_plugins(); + + /* Show plugins */ + foreach ($description as $name => $dsc){ + if ($count == 0){ + echo "Plugin\t\t| Description\n"; + echo "------------------------------------------------------------------------\n"; + } + echo "* $name\t\t| ".$dsc."\n"; + $count++; + } + + /* Yell about non existing plugins... */ + if ($count == 0){ + echo "No plugins found...\n\n"; + } else { + # Check for dependencies + dependency_check(); + echo "\n"; + } +} + + +function install_plugin($name) +{ + global $description, $provides, $depends; + + /* Load plugin list */ + load_plugins(); + + # go to the directory, load dsc file + # check if it already there + # check if all dependencies are fullfilled + # copy plugin + # update classlist + # update i18n + + #if (isset($)){ + #} +} + + +/* Fill global values */ +$description= $provides= $depends= array(); + /* Action specified? */ if ($argc < 2){ exit (0); } switch ($argv[1]){ case 'install-plugin': - echo "install\n"; + if (isset($argv[2])){ + install_plugin($argv[2]); + } else { + echo "Usage: update-gosa install-plugin directory\n\n"; + exit (1); + } break; case 'list-plugins': - echo "list\n"; + list_plugins(); break; case 'remove-plugin': echo "remove\n"; @@ -83,6 +278,9 @@ switch ($argv[1]){ case 'rescan-i18n': rescan_i18n(); break; + case 'rescan-classes': + rescan_classes(); + break; default: echo "Error: Supplied command not known\n\n"; print_usage(); diff --git a/gosa-core/update-gosa b/gosa-core/update-gosa deleted file mode 100755 index 0e6767e17..000000000 --- a/gosa-core/update-gosa +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/php5 - $value){ - fwrite ($handle, " \"$key\" => \"$value\",\n"); -} -fwrite ($handle, " );\n?>"); - -fclose($handle); - -/* Action specified? */ - - -# List plugins (plugstate dir) -# Merge locales locale dir/core + locale dir /plugins/*/ -# Install plugins > File list in plugstate dir -# Remove plugins < File list from plugstate dir - - -?> -- 2.30.2