Code

Updated host usage template
[gosa.git] / gosa-core / update-gosa
index 73eb2c69f47a89d65dc48e2f5c69a5101f3c29c5..55214d133d92abce2ba557858b96896ab11558e8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/php5
+#!/usr/bin/php
 <?php
 /*
  * This code is part of GOsa (http://www.gosa-project.org)
@@ -35,7 +35,7 @@ Usage: update-gosa install dsc     Install the plugin using the dsc information
        update-gosa remove plugin   Remove the plugin named "plugin" from
                                    the current configuration.
 
-       update-gosa lists           Lists installed plugins
+       update-gosa list           Lists installed plugins
 
        update-gosa rescan-i18n     Rebuilds the translations
 
@@ -177,7 +177,7 @@ function rescan_i18n()
                }
 
                /* Cat all these po files into one single file */
-               system ("(cd ".LOCALE_DIR." && msgcat ".implode(" ", $po_files)." > compiled/${language}/LC_MESSAGES/messages.po)", $val);
+               system ("(cd ".LOCALE_DIR." && msgcat --use-first ".implode(" ", $po_files)." > compiled/${language}/LC_MESSAGES/messages.po)", $val);
                if ($val != 0){
                        echo "Merging of message files failed - aborted";
                        exit (4);
@@ -188,6 +188,8 @@ function rescan_i18n()
                        exit (5);
                }
        }
+
+       echo "! Warning: you may need to reload your webservice!\n";
 }
 
 
@@ -218,13 +220,15 @@ function rescan_guide()
                $master_guide_content.= file_get_contents($guide);
        }
        
-       $plugins= scandir('doc/plugins');
-       foreach($plugins as $key => $plugin) {
-               if($plugin != '.' && $plugin != '..') {
-                       if(is_dir('doc/plugins/'.$plugin)) {
-                               $guide= 'doc/plugins/'.$plugin.'/guide.xml';
-                               if(file_exists($guide) && is_readable($guide)) {
-                                       $master_guide_content.= file_get_contents($guide);
+       if(file_exists('doc/plugins')) {
+               $plugins= scandir('doc/plugins');
+               foreach($plugins as $key => $plugin) {
+                       if($plugin != '.' && $plugin != '..') {
+                               if(is_dir('doc/plugins/'.$plugin)) {
+                                       $guide= 'doc/plugins/'.$plugin.'/guide.xml';
+                                       if(file_exists($guide) && is_readable($guide)) {
+                                               $master_guide_content.= file_get_contents($guide);
+                                       }
                                }
                        }
                }
@@ -234,7 +238,7 @@ function rescan_guide()
        
        $master_guide_content= preg_replace("/[ \t][ \t]*/", " ", $master_guide_content);
 
-       if(is_writable($master_guide)) {
+       if((file_exists($master_guide) && is_writable($master_guide)) || is_writable('doc')) {
                file_put_contents($master_guide, $master_guide_content);
        }
 
@@ -253,9 +257,9 @@ 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'];
+                               $provides[$res]= $res;
                                if (isset($plugin['depends'])){
                                        $depends[$res]= explode(',', preg_replace('/\s+/', '', $plugin['depends']));
                                }