1 #!/usr/bin/php
2 <?php
3 /*
4 * This code is part of GOsa (http://www.gosa-project.org)
5 * Copyright (C) 2003-2008 GONICUS GmbH
6 *
7 * ID: $$Id: main.php 9254 2008-03-03 15:57:49Z cajus $$
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
24 define ("GOSA_HOME", dirname(__FILE__));
25 define ("LOCALE_DIR", GOSA_HOME."/locale");
26 define ("PLUGSTATE_DIR", GOSA_HOME."/state");
28 function print_usage()
29 {
30 ?>
31 update-gosa - class cache updated and plugin manager for GOsa
32 Usage: update-gosa install dsc Install the plugin using the dsc information
33 placed in the plugin source directory.
35 update-gosa remove plugin Remove the plugin named "plugin" from
36 the current configuration.
38 update-gosa list Lists installed plugins
40 update-gosa rescan-i18n Rebuilds the translations
42 update-gosa rescan-classes Rebuilds the class list
44 update-gosa Shortcut for rescan-classes and rescan-i18n
45 <?php
46 exit (1);
47 }
50 function rmdirRecursive($path, $followLinks=false) {
51 $dir= opendir($path);
52 while($entry= readdir($dir)) {
53 if(is_file($path."/".$entry) || ((!$followLinks) && is_link($path."/".$entry))) {
54 unlink($path."/".$entry);
55 } elseif (is_dir($path."/".$entry) && $entry!='.' && $entry!='..') {
56 rmdirRecursive($path."/".$entry);
57 }
58 }
59 closedir($dir);
60 return rmdir($path);
61 }
64 /* Function to include all class_ files starting at a given directory base */
65 function get_classes($folder= ".")
66 {
67 static $base_dir= "";
68 static $result= array();
70 if ($base_dir == ""){
71 if ($folder == "."){
72 $base_dir= getcwd();
73 } else {
74 $base_dir= $folder;
75 }
76 }
78 $currdir=getcwd();
79 if ($folder){
80 chdir("$folder");
81 }
83 $dh = opendir(".");
84 while(false !== ($file = readdir($dh))){
86 if (preg_match("/.*\.svn.*/", $file) ||
87 preg_match("/.*smarty.*/i",$file) ||
88 preg_match("/.*\.tpl.*/",$file) ||
89 ($file==".") ||($file =="..")){
90 continue;
91 }
93 /* Recurse through all "common" directories */
94 if (is_dir($file)){
95 get_classes($file);
96 continue;
97 }
99 /* Only take care about .inc and .php files... */
100 if (!(preg_match('/\.php$/', $file) || preg_match('/\.inc$/', $file))){
101 continue;
102 }
104 /* Include existing class_ files */
105 $contents= file($file);
106 foreach($contents as $line){
107 $line= chop($line);
108 if (preg_match('/^\s*class\s*\w.*$/', $line)){
109 $class= preg_replace('/^\s*class\s*(\w+).*$/', '\1', $line);
110 $result[$class]= preg_replace("%$base_dir/%", "", "$currdir/$folder/$file");
111 }
112 }
113 }
115 closedir($dh);
116 chdir($currdir);
118 return ($result);
119 }
122 function rescan_classes()
123 {
124 echo "Updating class cache...\n";
125 $class_mapping= get_classes();
126 $filename= GOSA_HOME."/include/class_location.inc";
128 /* Sanity checks */
129 if (!file_exists($filename) || is_writable($filename)) {
131 if (!$handle= fopen($filename, 'w')) {
132 echo "Cannot open file \"$filename\" - aborted\n";
133 exit (1);
134 }
136 } else {
137 echo "File \"$filename\" is not writable - aborted\n";
138 exit (2);
139 }
141 fwrite ($handle, "<?php\n\$class_mapping= array(\n");
142 foreach ($class_mapping as $key => $value){
143 fwrite ($handle, " \"$key\" => \"$value\",\n");
144 }
145 fwrite ($handle, " );\n");
147 fclose($handle);
148 }
151 function rescan_i18n()
152 {
153 echo "Updating internationalization...\n";
154 $languages= array();
155 $size= strlen(LOCALE_DIR);
157 /* Get all available messages.po files, sort them for languages */
158 $dir= new RecursiveDirectoryIterator(LOCALE_DIR);
159 $all= new RecursiveIteratorIterator($dir);
160 foreach ( $all as $element ){
161 if ($element->isFile() && preg_match('/\/LC_MESSAGES\/messages.po$/', $element->getPathname())){
162 $lang= preg_replace('/^.*\/([^\/]+)\/LC_MESSAGES\/.*$/', '\1', $element);
163 if (!isset($languages[$lang])){
164 $languages[$lang]= array();
165 }
166 $languages[$lang][]= substr($element->getPathName(), $size+1);
167 }
168 }
170 /* For each language, merge the target .mo to the compiled directory. */
171 foreach ($languages as $language => $po_files){
172 if (!is_dir(LOCALE_DIR."/compiled/${language}/LC_MESSAGES")){
173 if (!mkdir (LOCALE_DIR."/compiled/${language}/LC_MESSAGES", 0755, TRUE)){
174 echo "Failed to create '".LOCALE_DIR."/compiled/${language}/LC_MESSAGES'- aborted";
175 exit (3);
176 }
177 }
179 /* Cat all these po files into one single file */
180 system ("(cd ".LOCALE_DIR." && msgcat --use-first ".implode(" ", $po_files)." > compiled/${language}/LC_MESSAGES/messages.po)", $val);
181 if ($val != 0){
182 echo "Merging of message files failed - aborted";
183 exit (4);
184 }
185 system ("(cd ".LOCALE_DIR."/compiled/${language}/LC_MESSAGES && msgfmt -o messages.mo messages.po && rm messages.po)", $val);
186 if ($val != 0){
187 echo "Compiling of message files failed - aborted";
188 exit (5);
189 }
190 }
192 echo "! Warning: you may need to reload your webservice!\n";
193 }
196 function rescan_guide()
197 {
198 $master_guide= "doc/guide.xml";
199 echo "Updating Online Help Index...\n";
200 $master_guide_content="<?xml version=\"1.0\"?>\n".
201 "<!--\n".
202 "\tWARNING:\n".
203 "\tThis file is automatically generated by update-online-help.\n".
204 "\tIf you want to add entries, use doc/core/guide.xml or doc/plugins/\"Appropriate Plugin Directory\"/guide.xml.\n".
205 "\tThen execute update-online-help to merge them into this file.\n".
206 "-->\n\n".
207 "<!--\n".
208 "\tThis xml file specifies which class is documented in which help file.\n".
209 "\tIf isset ( \$_SESSION['current_class_for_help'] ) then open the helpfile which is\n".
210 "\tspecified for this class below.\n".
211 "-->\n\n".
212 "<!--\n".
213 "\t<ENTRY NAME='class name' VALUE='displayed text' PATH='path to helpfiles' FILE='path to htmlfile' />\n".
214 "\tLeave blank to display message \"There is no helpfile specified for this class.\"\n".
215 "-->\n".
216 "<ENTRIES>\n";
218 $guide= 'doc/core/guide.xml';
219 if(file_exists($guide) && is_readable($guide)) {
220 $master_guide_content.= file_get_contents($guide);
221 }
223 if(file_exists('doc/plugins')) {
224 $plugins= scandir('doc/plugins');
225 foreach($plugins as $key => $plugin) {
226 if($plugin != '.' && $plugin != '..') {
227 if(is_dir('doc/plugins/'.$plugin)) {
228 $guide= 'doc/plugins/'.$plugin.'/guide.xml';
229 if(file_exists($guide) && is_readable($guide)) {
230 $master_guide_content.= file_get_contents($guide);
231 }
232 }
233 }
234 }
235 }
237 $master_guide_content.= "</ENTRIES>";
239 $master_guide_content= preg_replace("/[ \t][ \t]*/", " ", $master_guide_content);
241 if((file_exists($master_guide) && is_writable($master_guide)) || is_writable('doc')) {
242 file_put_contents($master_guide, $master_guide_content);
243 }
245 }
248 function parse_ini($file)
249 {
250 global $description, $provides, $depends, $versions, $conflicts;
252 $res= "";
253 if (file_exists($file)){
254 $tmp= parse_ini_file($file, TRUE);
256 if (isset($tmp['gosa-plugin'])){
257 $plugin= &$tmp['gosa-plugin'];
258 if (isset($plugin['name'])&& isset($plugin['description'])){
259 $res= $plugin['name'];
260 $description[$res]= $plugin['description'];
261 $versions[$res]= $plugin['version'];
262 $provides[$res]= $res;
263 if (isset($plugin['depends'])){
264 $depends[$res]= explode(',', preg_replace('/\s+/', '', $plugin['depends']));
265 }
266 if (isset($plugin['conflicts'])){
267 $conflicts[$res]= explode(',', preg_replace('/\s+/', '', $plugin['conflicts']));
268 }
269 }
270 }
271 }
273 return $res;
274 }
277 function dependency_check()
278 {
279 global $description, $provides, $depends;
281 foreach ($depends as $name => $pl_depends){
282 foreach ($pl_depends as $pl){
283 if (!in_array($pl, $provides)){
284 echo "! Error: plugin '$name' depends on '$pl' which is not provided by any plugin\n\n";
285 exit (1);
286 }
287 }
288 }
289 }
292 function load_plugins()
293 {
294 if (!is_dir(PLUGSTATE_DIR)){
295 if (!mkdir (PLUGSTATE_DIR, 0755, TRUE)){
296 echo "Cannot create plugstate dir '".PLUGSTATE_DIR."' - aborted\n";
297 exit (2);
298 }
299 }
300 $dir= new DirectoryIterator(PLUGSTATE_DIR);
301 foreach ($dir as $entry){
302 if ($dir->isDir() && !preg_match('/^\./', $dir->__toString())){
303 $file= $dir->getPathName()."/plugin.dsc";
304 if (parse_ini($file) == ""){
305 echo "! Warning: plugin ".$dir->getPathName()." is missing declarations\n";
306 }
307 }
308 }
309 }
312 function list_plugins()
313 {
314 global $description, $versions;
315 $count= 0;
317 /* Load plugin list */
318 load_plugins();
320 /* Show plugins */
321 foreach ($description as $name => $dsc){
322 if ($count == 0){
323 echo "Plugin\t\t|Version |Description\n";
324 echo "----------------------------------------------------------------------------\n";
325 }
326 $ver= $versions[$name];
327 echo "$name\t\t|$ver\t |$dsc\n";
328 $count++;
329 }
331 /* Yell about non existing plugins... */
332 if ($count == 0){
333 echo "No plugins found...\n\n";
334 } else {
335 # Check for dependencies
336 dependency_check();
337 echo "\n";
338 }
339 }
342 function install_plugin($file)
343 {
344 global $description, $provides, $depends, $conflicts;
346 /* Load plugin list */
347 load_plugins();
349 /* Load .dsc file */
350 if (file_exists($file)){
351 $tmp= parse_ini_file($file, TRUE);
353 if (isset($tmp['gosa-plugin'])){
354 $plugin= &$tmp['gosa-plugin'];
355 if (isset($plugin['name'])&& isset($plugin['description'])){
356 $name= $plugin['name'];
357 $description= $plugin['description'];
358 $depends= array();
359 if (isset($plugin['depends'])){
360 $depends= explode(',', preg_replace('/\s+/', '', $plugin['depends']));
361 }
363 /* Already installed? */
364 if (isset($provides[$name])){
365 echo "! Error: plugin already installed\n\n";
366 exit (3);
367 }
369 /* Check if dependencies are fullfilled */
370 foreach ($depends as $dep){
371 $found= false;
372 foreach ($provides as $provide => $dummy){
373 if ($dep == $provide){
374 $found= true;
375 break;
376 }
377 }
378 if (!$found){
379 echo "! Error: plugin depends on '$dep', but this is not installed\n\n";
380 exit (3);
381 }
382 }
384 /* Check for conflicts */
385 foreach ($conflicts as $conf){
386 if (!in_array($conf, $provides)){
387 echo "! Warning: plugin conflicts with '$conf'\n\n";
388 }
389 }
391 /* Create plugstate directory and touch plugin.lst */
392 if (!mkdir (PLUGSTATE_DIR."/$name", 0755, TRUE)){
393 echo "Failed to create '".PLUGSTATE_DIR."/$name - aborted";
394 exit (3);
395 }
396 if (!$handle= fopen(PLUGSTATE_DIR."/$name/plugin.lst", 'w')) {
397 echo "Cannot open file '$filename' - aborted\n";
398 exit (1);
399 }
401 echo "Installing plugin '$name'...\n";
403 /* Copy and fill plugin.lst */
404 $path= dirname($file);
405 $dir= new RecursiveDirectoryIterator($path);
406 $all= new RecursiveIteratorIterator($dir);
407 foreach ( $all as $entry ){
408 $source= $path."/".substr($entry->getPathName(), strlen($path) + 1);
410 /* Skip description - it belongs to the state dir */
411 if (preg_match('/\/plugin.dsc$/', $source)){
412 copy ($source, PLUGSTATE_DIR."/$name/plugin.dsc");
413 continue;
414 }
416 /* Skip well known directories */
417 if (preg_match('/^\.+$/', $source) || preg_match('/\/\.svn\//', $source)) {
418 continue;
419 }
421 /* Calculate destination */
422 if (preg_match("%^.*locale/%", $source)){
423 $dest= GOSA_HOME."/locale/plugins/$name/".preg_replace("%^.*locale/%", "", $source);
424 } elseif (preg_match("%^.*help/%", $source)) {
425 $dest= GOSA_HOME."/doc/plugins/$name/".preg_replace("%^.*help/%", "", $source);
426 } elseif (preg_match("%^.*html/%", $source)) {
427 $dest= GOSA_HOME."/html/plugins/$name/".preg_replace("%^.*html/%", "", $source);
428 } else {
429 $dest= GOSA_HOME."/plugins/".substr($entry->getPathName(), strlen($path) + 1);
430 }
432 /* Destination exists in case of directories? */
433 if ($entry->isDir()){
434 if (!is_dir($dest)){
435 mkdir($dest, 0755, TRUE);
436 fwrite ($handle, "$dest\n");
437 }
438 } else {
439 if (!is_dir(dirname($dest))){
440 mkdir(dirname($dest), 0755, TRUE);
441 fwrite ($handle, dirname($dest)."\n");
442 }
443 }
445 /* Copy files */
446 if ($entry->isFile()){
447 copy ($source, $dest);
448 }
450 /* Note what we did... */
451 fwrite ($handle, "$dest\n");
452 }
454 fclose($handle);
455 }
456 }
457 }
459 /* Update caches */
460 rescan_classes();
461 rescan_i18n();
462 rescan_guide();
463 }
466 function remove_plugin($name)
467 {
468 global $description, $depends;
470 /* Load plugin list */
471 load_plugins();
473 /* Present? */
474 if (!isset($description[$name])){
475 echo "! Error: cannot find a plugin named '$name'\n\n";
476 exit (1);
477 }
479 /* Depends? */
480 foreach ($depends as $sname => $pl_depends){
481 if (in_array($name, $pl_depends)){
482 echo "! Error: plugin '$sname' depends on '$name' - cannot remove it\n\n";
483 exit (1);
484 }
485 }
487 /* Load information */
488 if (!file_exists(PLUGSTATE_DIR."/$name/plugin.lst")){
489 echo "! Error: cannot remove plugin '$name' - no install history found\n\n";
490 exit (1);
491 }
493 echo "Removing plugin '$name'...\n";
494 $contents= file(PLUGSTATE_DIR."/$name/plugin.lst");
495 $cnv= array();
496 foreach($contents as $line){
497 $entry= chop($line);
498 $cnv[strlen($entry).":$entry"]= $entry;
499 }
500 krsort($cnv);
502 /* Remove files first */
503 clearstatcache();
504 foreach ($cnv as $entry){
505 if (is_dir($entry)){
506 rmdir($entry);
507 continue;
508 }
509 if (file_exists($entry)){
510 unlink($entry);
511 }
512 }
514 /* Remove state directory for plugin */
515 rmdirRecursive(PLUGSTATE_DIR."/$name");
517 /* Update caches */
518 rescan_classes();
519 rescan_i18n();
520 rescan_guide();
521 }
524 function rescan_images($path, $theme)
525 {
526 $widths= array();
527 $heights= array();
528 $paths= array();
529 $posX= array();
530 $posY= array();
531 $baseLength= strlen($path);
532 $heightStats= array();
533 $warnings= array();
534 $checksums= array();
535 $styles= array();
536 $duplicates= array();
538 // Check for image magick convert
539 if (!function_exists("imageFilter")){
540 exec("which convert", $res, $ret);
541 if ($ret != 0) {
542 die("Your system has no bundled gd support for imageFilter function. Please install imagemagick in order to use an external command.\n");
543 }
544 }
546 // Scan for images in the given path
547 echo "Scanning for images";
548 flush();
549 foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $fileInfo) {
551 // We're only interested in png files
552 $indexPath= substr($fileInfo->getPathname(), $baseLength + 1);
553 $path= $fileInfo->getPathname();
554 if (preg_match('/\.png$/', $indexPath) && !preg_match('/\.svn/', $path) && !preg_match('/themes\/[^\/]+\/img.png$/', $path)){
556 // Grey image if it is not already one
557 if (preg_match('/grey/', $indexPath)) {
558 echo "!";
559 $warnings[]= "Warning: skipped possible grey image $path";
560 flush();
561 continue;
562 }
564 // Grey image if it is not already one
565 if (preg_match('/new/', $indexPath)) {
566 echo "!";
567 $warnings[]= "Warning: skipped possible grey image $path";
568 flush();
569 continue;
570 }
572 // Catch available themes
573 if (preg_match('/themes\//', $indexPath) && !preg_match('/themes\/'.$theme.'\//', $indexPath)) {
574 continue;
575 }
577 // Load image
578 $img= imageCreateFromPng($path);
579 $width= imageSX($img);
580 $height= imageSY($img);
581 imageDestroy($img);
582 $greyIndexPath= preg_replace('/\.png$/', '-grey.png', $indexPath);
584 // Is this image already there?
585 $checksum= md5_file($path);
586 if (in_array($checksum, $checksums)) {
587 $warnings[]= "Warning: images $indexPath seems to be a duplicate of ".array_search($checksum, $checksums);
588 $duplicates[$indexPath]= array_search($checksum, $checksums);
589 $duplicates[$greyIndexPath]= preg_replace('/\.png$/', '-grey.png', array_search($checksum, $checksums));
590 } else {
591 $checksums[$indexPath]= $checksum;
592 }
594 // Ordinary image
595 $widths[$indexPath]= $width;
596 $heights[$indexPath]= $height;
597 $paths[$indexPath]= $path;
599 // Grey image
600 $widths[$greyIndexPath]= $width;
601 $heights[$greyIndexPath]= $height;
602 $paths[$greyIndexPath]= $path;
604 // Feed height statistics
605 if (!isset($heightStats[$height])) {
606 $heightStats[$height]= 1;
607 } else {
608 $heightStats[$height]++;
609 }
610 }
612 echo ".";
613 flush();
614 }
615 echo "\n";
617 // Do some stupid height calculation
618 arsort($heightStats, SORT_NUMERIC);
619 reset($heightStats);
620 $popular= current($heightStats);
622 krsort($heightStats);
623 reset($heightStats);
624 $max= current($heightStats);
626 $maxHeight= (floor($max / $popular) + 1) * $popular * 6;
628 // Sort to get biggest values
629 arsort($widths, SORT_NUMERIC);
630 reset($widths);
631 echo "Calculating master image dimensions: ";
632 flush();
634 // Build container image
635 $cursorX= 0;
636 $cursorY= 0;
637 $colWidth= 0;
638 $rowHeight= 0;
639 $colX= 0;
640 $colY= 0;
641 $maxY= 0;
642 $maxX= 0;
644 // Walk thru width sorted images
645 foreach ($widths as $imagePath => $imageWidth) {
646 $imageHeight= $heights[$imagePath];
648 // First element in this column
649 if ($colWidth == 0) {
650 $colWidth= $imageWidth;
651 }
653 // First element in this row
654 if ($rowHeight < $imageHeight) {
655 $rowHeight= $imageHeight;
656 }
658 // Does the image match here?
659 if ($cursorX + $imageWidth > $colX + $colWidth) {
661 if ($cursorY + $imageHeight >= $maxHeight) {
663 // Reached max height, move to the next column
664 $colX+= $colWidth;
665 $cursorX= $colX;
666 $colWidth= $imageWidth;
667 $rowHeight= $imageHeight;
668 $colY= $cursorY= 0;
670 } else {
672 // Next row
673 $colY+= $rowHeight;
674 $cursorY= $colY;
675 $cursorX= $colX;
676 $rowHeight= $imageHeight;
677 }
679 $maxY=($colY + $imageHeight > $maxY)?$colY+$imageHeight:$maxY;
680 }
682 // Save calculated position
683 $posX[$imagePath]= $cursorX;
684 $posY[$imagePath]= $cursorY;
686 // Move X cursor to the next position
687 $cursorX+= $imageWidth;
689 $maxX=($colX > $maxX)?$colX:$maxX;
690 }
692 // Print maximum dimensions
693 echo $maxY."x".$maxX."\n";
694 echo "Processing";
695 flush();
697 // Create result image
698 $dst= imageCreateTrueColor($maxX, $maxY);
699 imageAlphaBlending($dst, true);
700 $transparent = imagecolorallocatealpha($dst, 0, 0, 0, 127);
701 imageFill($dst, 0, 0, $transparent);
702 imageSaveAlpha($dst, true);
704 // Finally assemble picture
705 foreach ($heights as $imagePath => $imageHeight) {
706 $imageWidth= $widths[$imagePath];
707 $x= $posX[$imagePath];
708 $y= $posY[$imagePath];
710 // Insert source image...
712 // Duplicate?
713 if (isset($duplicates[$imagePath])){
714 $imageHeight= $heights[$duplicates[$imagePath]];
715 $imageWidth= $widths[$duplicates[$imagePath]];
716 $x= $posX[$duplicates[$imagePath]];
717 $y= $posY[$duplicates[$imagePath]];
718 } else {
720 // Eventually convert it to grey before
721 if (preg_match('/-grey\.png$/', $imagePath)) {
722 if (!function_exists("imageFilter")){
723 exec("convert ".$paths[$imagePath]." -colorspace Gray /tmp/grey-converted.png");
724 $src= imageCreateFromPng("/tmp/grey-converted.png");
725 } else {
726 $src= imageCreateFromPng($paths[$imagePath]);
727 imageFilter($src, IMG_FILTER_GRAYSCALE);
728 }
729 } else {
730 $src= imageCreateFromPng($paths[$imagePath]);
731 }
733 // Merge image
734 imageCopyResampled($dst, $src, $x, $y, 0, 0, $imageWidth, $imageHeight, $imageWidth, $imageHeight);
735 imageDestroy($src);
736 }
738 // Store style
739 $styles[$imagePath]= "background-position:-".$x."px -".$y."px;width:".$imageWidth."px;height:".$imageHeight."px";
741 echo ".";
742 flush();
743 }
745 imagePNG($dst, "html/themes/$theme/img.png", 9);
746 imageDestroy($dst);
748 // Show warnings images
749 foreach ($warnings as $warn) {
750 echo "$warn\n";
751 }
753 // Write styles
754 echo "Writing styles...";
755 $fp = fopen("ihtml/themes/$theme/img.styles", 'w');
756 fwrite($fp, serialize($styles));
757 fclose($fp);
759 echo "\n";
760 }
763 /* Fill global values */
764 $description= $provides= $depends= $versions= $conflicts= array();
766 /* Action specified? */
767 if ($argc < 2){
768 rescan_classes();
769 rescan_i18n();
770 rescan_guide();
771 rescan_images("html", "modern");
772 exit (0);
773 }
775 switch ($argv[1]){
776 case 'install':
777 if (isset($argv[2])){
778 install_plugin($argv[2]);
779 } else {
780 echo "Usage: update-gosa install dsc-file\n\n";
781 exit (1);
782 }
783 break;
784 case 'list':
785 list_plugins();
786 break;
787 case 'remove':
788 if (isset($argv[2])){
789 remove_plugin($argv[2]);
790 } else {
791 echo "Usage: update-gosa remove plugin-name\n\n";
792 exit (1);
793 }
794 break;
795 case 'rescan-i18n':
796 rescan_i18n();
797 break;
798 case 'rescan-classes':
799 rescan_classes();
800 break;
801 case 'rescan-images':
802 rescan_images("html", "modern");
803 break;
804 default:
805 echo "Error: Supplied command not known\n\n";
806 print_usage();
807 break;
808 }
811 ?>