From: rettenbe Date: Wed, 1 Oct 2008 09:22:42 +0000 (+0000) Subject: bufix: dynamic loading of databases X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b96ad3d892fa89e099d6f659a4146f1ee64e8143;p=gosa.git bufix: dynamic loading of databases git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12577 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index c0b0fa8b1..ad0e99fa3 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -3174,80 +3174,120 @@ daemon_log("status: $server_status", 1); daemon_log($server_status_hash->{$server_status}.": $server_revision", 1); { -no strict "refs"; + no strict "refs"; -require ("GOSA/".$db_module.".pm"); -("GOSA/".$db_module)->import; -daemon_log("0 INFO: importing database module '$db_module'", 1); + if ($db_module eq "DBmysql") { + # connect to incoming_db + $incoming_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $incoming_db->create_table($incoming_tn, \@incoming_col_names); + + # connect to gosa-si job queue + $job_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $job_db->create_table($job_queue_tn, \@job_queue_col_names); + + # connect to known_clients_db + $known_clients_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $known_clients_db->create_table($known_clients_tn, \@known_clients_col_names); + + # connect to foreign_clients_db + $foreign_clients_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $foreign_clients_db->create_table($foreign_clients_tn, \@foreign_clients_col_names); + + # connect to known_server_db + $known_server_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $known_server_db->create_table($known_server_tn, \@known_server_col_names); + + # connect to login_usr_db + $login_users_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $login_users_db->create_table($login_users_tn, \@login_users_col_names); + + # connect to fai_server_db + $fai_server_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $fai_server_db->create_table($fai_server_tn, \@fai_server_col_names); + + # connect to fai_release_db + $fai_release_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $fai_release_db->create_table($fai_release_tn, \@fai_release_col_names); + + # connect to packages_list_db + $packages_list_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $packages_list_db->create_table($packages_list_tn, \@packages_list_col_names); -# connect to incoming_db -unlink($incoming_file_name); -$incoming_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$incoming_db->create_table($incoming_tn, \@incoming_col_names); - -# connect to gosa-si job queue -unlink($job_queue_file_name); ## just for debugging -$job_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$job_db->create_table($job_queue_tn, \@job_queue_col_names); -chmod(0660, $job_queue_file_name); -chown($root_uid, $adm_gid, $job_queue_file_name); - -# connect to known_clients_db -unlink($known_clients_file_name); ## just for debugging -$known_clients_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$known_clients_db->create_table($known_clients_tn, \@known_clients_col_names); -chmod(0660, $known_clients_file_name); -chown($root_uid, $adm_gid, $known_clients_file_name); - -# connect to foreign_clients_db -unlink($foreign_clients_file_name); -$foreign_clients_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$foreign_clients_db->create_table($foreign_clients_tn, \@foreign_clients_col_names); -chmod(0660, $foreign_clients_file_name); -chown($root_uid, $adm_gid, $foreign_clients_file_name); - -# connect to known_server_db -unlink($known_server_file_name); -$known_server_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$known_server_db->create_table($known_server_tn, \@known_server_col_names); -chmod(0660, $known_server_file_name); -chown($root_uid, $adm_gid, $known_server_file_name); - -# connect to login_usr_db -unlink($login_users_file_name); -$login_users_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$login_users_db->create_table($login_users_tn, \@login_users_col_names); -chmod(0660, $login_users_file_name); -chown($root_uid, $adm_gid, $login_users_file_name); - -# connect to fai_server_db -unlink($fai_server_file_name); -$fai_server_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$fai_server_db->create_table($fai_server_tn, \@fai_server_col_names); -chmod(0660, $fai_server_file_name); -chown($root_uid, $adm_gid, $fai_server_file_name); - -# connect to fai_release_db -unlink($fai_release_file_name); -$fai_release_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$fai_release_db->create_table($fai_release_tn, \@fai_release_col_names); -chmod(0660, $fai_release_file_name); -chown($root_uid, $adm_gid, $fai_release_file_name); - -# connect to packages_list_db -#unlink($packages_list_file_name); -unlink($packages_list_under_construction); -$packages_list_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$packages_list_db->create_table($packages_list_tn, \@packages_list_col_names); -chmod(0660, $packages_list_file_name); -chown($root_uid, $adm_gid, $packages_list_file_name); - -# connect to messaging_db -unlink($messaging_file_name); -$messaging_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); -$messaging_db->create_table($messaging_tn, \@messaging_col_names); -chmod(0660, $messaging_file_name); -chown($root_uid, $adm_gid, $messaging_file_name); + # connect to messaging_db + $messaging_db = ("GOSA::".$db_module)->new($main::mysql_database, $main::mysql_host, $main::mysql_username, $main::mysql_password); + $messaging_db->create_table($messaging_tn, \@messaging_col_names); + + } elsif ($db_module eq "DBsqlite") { + # connect to incoming_db + unlink($incoming_file_name); + $incoming_db = GOSA::DBsqlite->new($incoming_file_name); + $incoming_db->create_table($incoming_tn, \@incoming_col_names); + + # connect to gosa-si job queue + unlink($job_queue_file_name); ## just for debugging + $job_db = GOSA::DBsqlite->new($job_queue_file_name); + $job_db->create_table($job_queue_tn, \@job_queue_col_names); + chmod(0660, $job_queue_file_name); + chown($root_uid, $adm_gid, $job_queue_file_name); + + # connect to known_clients_db + unlink($known_clients_file_name); ## just for debugging + $known_clients_db = GOSA::DBsqlite->new($known_clients_file_name); + $known_clients_db->create_table($known_clients_tn, \@known_clients_col_names); + chmod(0660, $known_clients_file_name); + chown($root_uid, $adm_gid, $known_clients_file_name); + + # connect to foreign_clients_db + unlink($foreign_clients_file_name); + $foreign_clients_db = GOSA::DBsqlite->new($foreign_clients_file_name); + $foreign_clients_db->create_table($foreign_clients_tn, \@foreign_clients_col_names); + chmod(0660, $foreign_clients_file_name); + chown($root_uid, $adm_gid, $foreign_clients_file_name); + + # connect to known_server_db + unlink($known_server_file_name); + $known_server_db = GOSA::DBsqlite->new($known_server_file_name); + $known_server_db->create_table($known_server_tn, \@known_server_col_names); + chmod(0660, $known_server_file_name); + chown($root_uid, $adm_gid, $known_server_file_name); + + # connect to login_usr_db + unlink($login_users_file_name); + $login_users_db = GOSA::DBsqlite->new($login_users_file_name); + $login_users_db->create_table($login_users_tn, \@login_users_col_names); + chmod(0660, $login_users_file_name); + chown($root_uid, $adm_gid, $login_users_file_name); + + # connect to fai_server_db + unlink($fai_server_file_name); + $fai_server_db = GOSA::DBsqlite->new($fai_server_file_name); + $fai_server_db->create_table($fai_server_tn, \@fai_server_col_names); + chmod(0660, $fai_server_file_name); + chown($root_uid, $adm_gid, $fai_server_file_name); + + # connect to fai_release_db + unlink($fai_release_file_name); + $fai_release_db = GOSA::DBsqlite->new($fai_release_file_name); + $fai_release_db->create_table($fai_release_tn, \@fai_release_col_names); + chmod(0660, $fai_release_file_name); + chown($root_uid, $adm_gid, $fai_release_file_name); + + # connect to packages_list_db + #unlink($packages_list_file_name); + unlink($packages_list_under_construction); + $packages_list_db = GOSA::DBsqlite->new($packages_list_file_name); + $packages_list_db->create_table($packages_list_tn, \@packages_list_col_names); + chmod(0660, $packages_list_file_name); + chown($root_uid, $adm_gid, $packages_list_file_name); + + # connect to messaging_db + unlink($messaging_file_name); + $messaging_db = GOSA::DBsqlite->new($messaging_file_name); + $messaging_db->create_table($messaging_tn, \@messaging_col_names); + chmod(0660, $messaging_file_name); + chown($root_uid, $adm_gid, $messaging_file_name); + + } } # create xml object used for en/decrypting