summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e92686b)
raw | patch | inline | side by side (parent: e92686b)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Apr 2008 15:24:18 +0000 (15:24 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Apr 2008 15:24:18 +0000 (15:24 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10251 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/server/events/logHandling.pm | patch | blob | history | |
gosa-si/tests/client.php | patch | blob | history |
index 07e8c1adf2239ebb0d82a004db1bd056a5c7a834..bad5d9fc9e166c3821eb475414f4e72da4742398 100644 (file)
@ISA = qw(Exporter);
my @events = (
"get_events",
-# "show_log_by_mac",
-# "show_log_by_date",
+ "show_log_by_mac",
+ "show_log_by_date",
# "show_log_by_date_and_mac",
# "get_log_by_date",
# "get_log_by_mac",
# goto each mac directory
# select all dates which matches the parameter dates
my %res_h;
- foreach my $date ($date_l) {
+ foreach my $date ( @{$date_l} ) {
# go through all mac addresses
foreach my $mac (@avail_macs) {
- my $mac_dir = File::Spec->catdir($main::client_fai_log_dir, $mac);
+ if ($mac eq ".." || $mac eq ".") { next; }
+ # read all installations dates
+ my $mac_dir = File::Spec->catdir($main::client_fai_log_dir, $mac);
opendir(DIR, $mac_dir);
my @avail_dates = readdir(DIR);
closedir(DIR);
# go through all dates of one mac address
foreach my $avail_date (@avail_dates) {
+ if ($avail_date eq ".." || $avail_date eq ".") { next; }
if ($avail_date =~ /$date/i) {
- if (not exists %res)
- push(%res_h->{$mac}, );
- }
+ #$mac =~ s/:/_/g;
+ &add_content2xml_hash($out_hash, $avail_date, $mac);
+ }
}
}
}
+ my $out_msg = &create_xml_string($out_hash);
+ return ($out_msg);
}
sub show_log_by_mac {
return;
}
+ # fetch mac directory
+ opendir(DIR, $main::client_fai_log_dir);
+ my @avail_macs = readdir(DIR);
+ closedir(DIR);
+
# build out_msg
my $out_hash = &create_xml_hash($header, $target, $source);
foreach my $mac (@{$mac_l}) {
- my $act_log_dir = File::Spec->catdir($main::client_fai_log_dir, $mac);
- if (not -d $act_log_dir) { next; }
- $mac =~ s/:/_/g;
-
- # fetch mac directory
- opendir(DIR, $act_log_dir);
- my @install_dates = readdir(DIR);
- closedir(DIR);
- foreach my $date (@install_dates) {
- if ($date eq ".." || $date eq ".") { next; }
- &add_content2xml_hash($out_hash, "mac_$mac", $date);
+ foreach my $avail_mac ( @avail_macs ) {
+ if ($avail_mac eq ".." || $avail_mac eq ".") { next; }
+ if ($avail_mac =~ /$mac/i) {
+ my $act_log_dir = File::Spec->catdir($main::client_fai_log_dir, $avail_mac);
+ if (not -d $act_log_dir) { next; }
+ $avail_mac =~ s/:/_/g;
+
+ # fetch mac directory
+ opendir(DIR, $act_log_dir);
+ my @install_dates = readdir(DIR);
+ closedir(DIR);
+ foreach my $date (@install_dates) {
+ if ($date eq ".." || $date eq ".") { next; }
+ &add_content2xml_hash($out_hash, "mac_$avail_mac", $date);
+ }
+ }
}
}
index 4fa3eb402f7d45b5c9d0604456c9522503906b10..425c828185fac83dd643fba6283439ab8f26bc79 100755 (executable)
--- a/gosa-si/tests/client.php
+++ b/gosa-si/tests/client.php
################
# logHandling.pm
-#$data = "<xml> <header>gosa_show_log_by_mac</header> <target>GOSA</target> <source>GOSA</source> <mac>00:01:6c:9d:b9:fa</mac> </xml>";
+#$data = "<xml> <header>gosa_show_log_by_mac</header> <target>GOSA</target> <source>GOSA</source> <mac>00:01:6C:9D:B9:FA</mac> <mac>00:01:6c:9d:b9:fb</mac> </xml>";
+$data = "<xml> <header>gosa_show_log_by_date</header> <target>GOSA</target> <source>GOSA</source> <date>20080313</date> <date>20080323</date> </xml>";