From 4901496e8d4627acaad0e23f62f1cfc11e98cca8 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 5 Nov 2010 15:46:16 +0000 Subject: [PATCH] Updated the setup procedure -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 | 7 +++--- gosa-core/include/class_config.inc | 11 +++++---- gosa-core/include/functions.inc | 24 +++++++++++++++++++ .../generic/dashBoard/class_dashBoard.inc | 3 +++ gosa-core/setup/class_setupStep_Welcome.inc | 6 ++++- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/gosa-core/contrib/gosa.conf b/gosa-core/contrib/gosa.conf index 6c53399d9..949f16491 100644 --- a/gosa-core/contrib/gosa.conf +++ b/gosa-core/contrib/gosa.conf @@ -1,5 +1,6 @@ {literal}{/literal} - + - - + + diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index fa421a05c..329ae0fd0 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -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 */ diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 893d1431d..146372120 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -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: ?> diff --git a/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc b/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc index 89fd2fc6d..a983faf36 100644 --- a/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc +++ b/gosa-core/plugins/generic/dashBoard/class_dashBoard.inc @@ -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(); diff --git a/gosa-core/setup/class_setupStep_Welcome.inc b/gosa-core/setup/class_setupStep_Welcome.inc index 9ac8ae038..8ef8cba7f 100644 --- a/gosa-core/setup/class_setupStep_Welcome.inc +++ b/gosa-core/setup/class_setupStep_Welcome.inc @@ -23,14 +23,18 @@ 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() -- 2.30.2