From: rettenbe Date: Tue, 11 Mar 2008 15:46:10 +0000 (+0000) Subject: bugfix: create_packages_list_db X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5b74de3a7af0eb05b1fc34c17983142829e5c27c;p=gosa.git bugfix: create_packages_list_db git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9685 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 3243918fe..dfa840aa8 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -1890,40 +1890,6 @@ sub apply_fai_inheritance { return $fai_classes; } -sub get_fai_release_entries { - my $tmp_classes = shift || return; - my $parent = shift || ""; - my @result = shift || (); - - foreach my $entry (keys %{$tmp_classes}) { - if(defined($entry)) { - if($entry =~ /^ou=.*$/) { - my $release_name = $entry; - $release_name =~ s/ou=//g; - if(length($parent)>0) { - $release_name = $parent."/".$release_name; - } - my @bufentries = get_fai_release_entries($tmp_classes->{$entry}, $release_name, @result); - foreach my $bufentry(@bufentries) { - push @result, $bufentry; - } - } else { - my @types = get_fai_types($tmp_classes->{$entry}); - foreach my $type (@types) { - push @result, - { - 'class' => $entry, - 'type' => $type->{'type'}, - 'release' => $parent, - 'state' => $type->{'state'}, - }; - } - } - } - } - - return @result; -} sub deep_copy { my $this = shift; @@ -2043,7 +2009,7 @@ sub parse_package { } open($PACKAGES, "<$path.in"); - if(defined($PACKAGES)) { + if(not defined($PACKAGES)) { daemon_log("ERROR: create_packages_list_db: parse_package: can not open '$path.in'",1); return; } diff --git a/gosa-si/server/events/databases.pm b/gosa-si/server/events/databases.pm index 279ca6e9f..c92319ed2 100644 --- a/gosa-si/server/events/databases.pm +++ b/gosa-si/server/events/databases.pm @@ -12,6 +12,8 @@ my @events = ( "count_packages_list", "query_fai_server", "count_fai_server", + "query_fai_releases", + "count_fai_releases", ); @EXPORT = @events; @@ -33,7 +35,7 @@ sub get_events { return \@events; } - +sub query_fai_releases{ return &query_db( @_ ); } sub query_fai_server{ return &query_db( @_ ) ; } sub query_packages_list { return &query_db( @_ ) ; } sub query_jobdb { return &query_db( @_ ) ; } @@ -50,10 +52,14 @@ sub query_db { } elsif( $header =~ /query_packages_list/ ) { $table = $main::packages_list_tn; $db = $main::packages_list_db; - }± elsif( $header =~ /query_fai_server/ ) { + } elsif( $header =~ /query_fai_server/ ) { $table = $main::fai_server_tn; $db = $main::fai_server_db + } elsif( $header =~ /count_fai_releases/ ) { + $table = $main::fai_releases_tn; + $db = $main::fai_server_db } + # prepare sql statement and execute query my $select= &get_select_statement($msg, $msg_hash); @@ -68,6 +74,7 @@ sub query_db { return @out_msg_l; } +sub count_fai_releases{ return &count_db( @_ ); } sub count_fai_server{ return &count_db( @_ ); } sub count_packages_list{ return &count_db( @_ ); } sub count_jobdb{ return &count_db( @_ ); } @@ -79,8 +86,6 @@ sub count_db { my $table; my $db; - - if( $header =~ /count_jobdb/ ) { $table = $main::job_queue_tn; $db = $main::job_db; @@ -90,8 +95,12 @@ sub count_db { } elsif( $header =~ /count_fai_server/ ) { $table = $main::fai_server_tn; $db = $main::fai_server_db + } elsif( $header =~ /count_fai_releases/ ) { + $table = $main::fai_releases_tn; + $db = $main::fai_server_db } + # prepare sql statement and execute query my $res_hash = $db->select_dbentry("SELECT * FROM $table");