Code

Updated the setup procedure
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 5 Nov 2010 15:46:16 +0000 (15:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 5 Nov 2010 15:46:16 +0000 (15:46 +0000)
-Create a UUID for the currently installed GOsa instance.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20195 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/contrib/gosa.conf
gosa-core/include/class_config.inc
gosa-core/include/functions.inc
gosa-core/plugins/generic/dashBoard/class_dashBoard.inc
gosa-core/setup/class_setupStep_Welcome.inc

index 6c53399d9451b15fc56d5ccae1d929a281fe0d49..949f16491b1b10c4f0425bb5dc188bc08e746fe0 100644 (file)
@@ -1,5 +1,6 @@
 {literal}<?xml version="1.0"?>{/literal}
-<conf configVersion="{$config_checksum}" >
+<conf configVersion="{$config_checksum}" 
+      instanceUUID="{$cv.instanceUUID}">
 
   <!-- GOsa menu definition **************************************************
 
@@ -73,8 +74,8 @@
   <!-- These entries will be rendered on the short-cut menu -->
   <shortCutMenu>
       <plugin acl="all" class="welcome" />
-      <!-- <plugin acl="all" class="dashBoard" />-->
-      <!-- <plugin acl="all" class="statistics" />-->
+      <plugin acl="all" class="dashBoard" />
+      <plugin acl="all" class="statistics" />
   </shortCutMenu>
 
   <!-- These entries will be rendered on the path navigator -->
index fa421a05c69d61778b21601155bcfd23bc4c0ad9..329ae0fd014d50103cd7f0187edba8b2b41ff36c 100644 (file)
@@ -64,7 +64,7 @@ class config  {
     var $filename = "";
     var $last_modified = 0;
 
-    var $gosaUUID = "";
+    var $instanceUUID = "";
 
     private $jsonRPChandle = NULL; 
 
@@ -81,8 +81,6 @@ class config  {
         $this->parser = xml_parser_create();
         $this->basedir= $basedir;
 
-        $this->gosaUUID = uniqid();
-
         xml_set_object($this->parser, $this);
         xml_set_element_handler($this->parser, "tag_open", "tag_close");
 
@@ -96,9 +94,9 @@ class config  {
     }
 
 
-    function getGOsaUUID()
+    function getInstanceUUID()
     {
-        return($this->gosaUUID);
+        return($this->instanceUUID);
     }    
 
 
@@ -186,6 +184,9 @@ class config  {
             if(isset($attrs['CONFIGVERSION'])){
                 $this->config_version = $attrs['CONFIGVERSION'];
             }
+            if(isset($attrs['INSTANCEUUID'])){
+                $this->instanceUUID = $attrs['INSTANCEUUID'];
+            }
         }
 
         /* Return if we're not in config section */
index 893d1431d386971e9c26885bb3daf41109d5f324..146372120e882eb291efb5b398471ecb50238185 100644 (file)
@@ -3849,5 +3849,29 @@ function gen_uid_proposals(&$rules, $tag, $values)
     return($newRules);
 }
 
+
+function gen_uuid() 
+{
+    return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
+        // 32 bits for "time_low"
+        mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
+
+        // 16 bits for "time_mid"
+        mt_rand( 0, 0xffff ),
+
+        // 16 bits for "time_hi_and_version",
+        // four most significant bits holds version number 4
+        mt_rand( 0, 0x0fff ) | 0x4000,
+
+        // 16 bits, 8 bits for "clk_seq_hi_res",
+        // 8 bits for "clk_seq_low",
+        // two most significant bits holds zero and one for variant DCE1.1
+        mt_rand( 0, 0x3fff ) | 0x8000,
+
+        // 48 bits for "node"
+        mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
+    );
+}
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 89fd2fc6d7964d1e87d758ed3ded35f10fae85ae..a983faf369182ef6f200fc8d1032bbccc2bc6d22 100644 (file)
@@ -56,6 +56,9 @@ class dashBoard extends plugin
     function save_object()
     {
         plugin::save_object();
+        
+        if(!$this->registered) $this->GOsaRegistration->save_object();
+
         $this->dbPluginStatus->save_object();
         $this->dbChannelStatus->save_object();
         $this->dbNotifications->save_object();
index 9ac8ae03802493514441add20372049f15070049..8ef8cba7f4a29841f5670eb56f26912c01ff1310 100644 (file)
 class Step_Welcome  extends setup_step
 {
   var $languages      = array();
-  var $attributes     = array();
+  var $attributes     = array('instanceUUID');
   var $header_image   = "images/setup/welcome.png";
 
+    var $instanceUUID = "";
+    
   function Step_Welcome()
   {
     $this->is_enabled     = TRUE;
     $this->is_active      = TRUE;
     $this->update_strings(); 
+
+    $this->instanceUUID = gen_uuid();
   }
 
   function update_strings()