Code

server_server_com.pm: dead clients will be deleted from known_clients_db when the...
[gosa.git] / gosa-core / update-gosa
index a4f418e1f05f3dd23e1dbb734bc1ab4445841bef..a8827e8cd3f3c709816876453bad19249262b8e9 100755 (executable)
@@ -1,5 +1,25 @@
-#!/usr/bin/php5
+#!/usr/bin/php
 <?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: main.php 9254 2008-03-03 15:57:49Z cajus $$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 define ("GOSA_HOME", dirname(__FILE__));
 define ("LOCALE_DIR", GOSA_HOME."/locale");
@@ -15,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
 
@@ -168,6 +188,60 @@ function rescan_i18n()
                        exit (5);
                }
        }
+
+       echo "! Warning: you may need to reload your webservice!\n";
+}
+
+
+function rescan_guide()
+{
+       $master_guide= "doc/guide.xml";
+       echo "Updating Online Help Index...\n";
+       $master_guide_content="<?xml version=\"1.0\"?>\n".
+               "<!--\n".
+               "\tWARNING:\n".
+               "\tThis file is automatically generated by update-online-help.\n".
+               "\tIf you want to add entries, use doc/core/guide.xml or doc/plugins/\"Appropriate Plugin Directory\"/guide.xml.\n".
+               "\tThen execute update-online-help to merge them into this file.\n".
+               "-->\n\n".
+               "<!--\n".
+               "\tThis xml file specifies which class is documented in which help file.\n".
+               "\tIf isset ( \$_SESSION['current_class_for_help'] ) then open the helpfile which is\n".
+               "\tspecified for this class below.\n".
+               "-->\n\n".
+               "<!--\n".
+               "\t<ENTRY NAME='class name' VALUE='displayed text' PATH='path to helpfiles' FILE='path to htmlfile' />\n".
+               "\tLeave blank to display message \"There is no helpfile specified for this class.\"\n".
+               "-->\n".
+               "<ENTRIES>\n";
+
+       $guide= 'doc/core/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);
+                                       }
+                               }
+                       }
+               }
+       }
+
+       $master_guide_content.= "</ENTRIES>";
+       
+       $master_guide_content= preg_replace("/[ \t][ \t]*/", " ", $master_guide_content);
+
+       if((file_exists($master_guide) && is_writable($master_guide)) || is_writable('doc')) {
+               file_put_contents($master_guide, $master_guide_content);
+       }
+
 }
 
 
@@ -183,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']));
                                }
@@ -346,7 +420,11 @@ function install_plugin($file)
 
                                        /* Calculate destination */
                                        if (preg_match("%^.*locale/%", $source)){
-                                               $dest= GOSA_HOME."/locale/plugin/$name/".preg_replace("%^.*locale/%", "", $source);
+                                               $dest= GOSA_HOME."/locale/plugins/$name/".preg_replace("%^.*locale/%", "", $source);
+                                       } elseif (preg_match("%^.*help/%", $source)) {
+                                               $dest= GOSA_HOME."/doc/plugins/$name/".preg_replace("%^.*help/%", "", $source);
+                                       } elseif (preg_match("%^.*html/%", $source)) {
+                                               $dest= GOSA_HOME."/html/plugins/$name/".preg_replace("%^.*html/%", "", $source);
                                        } else {
                                                $dest= GOSA_HOME."/plugins/".substr($entry->getPathName(), strlen($path) + 1);
                                        }
@@ -381,6 +459,7 @@ function install_plugin($file)
        /* Update caches */
        rescan_classes();
        rescan_i18n();
+       rescan_guide();
 }
 
 
@@ -438,6 +517,7 @@ function remove_plugin($name)
        /* Update caches */
        rescan_classes();
        rescan_i18n();
+       rescan_guide();
 }
 
 
@@ -449,6 +529,7 @@ $description= $provides= $depends= $versions= $conflicts= array();
 if ($argc < 2){
        rescan_classes();
        rescan_i18n();
+       rescan_guide();
         exit (0);
 }