~ubuntu-branches/ubuntu/natty/otrs2/natty-updates

« back to all changes in this revision

Viewing changes to bin/otrs.getConfig

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2007-04-14 17:58:55 UTC
  • mto: (20.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: package-import@ubuntu.com-20070414175855-9ne0w01yu1q44ch0
Tags: upstream-2.1.7
ImportĀ upstreamĀ versionĀ 2.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/perl -w
2
2
# --
3
3
# bin/otrs.getConfig - get OTRS config vars
4
 
# Copyright (C) 2002 Martin Edenhofer <martin+code@otrs.org>
 
4
# Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
5
5
# --
6
 
# $Id: otrs.getConfig,v 1.6 2003/02/08 15:05:11 martin Exp $
 
6
# $Id: otrs.getConfig,v 1.8 2006/11/02 12:20:59 tr Exp $
7
7
# --
8
8
# This program is free software; you can redistribute it and/or modify
9
9
# it under the terms of the GNU General Public License as published by
10
10
# the Free Software Foundation; either version 2 of the License, or
11
11
# (at your option) any later version.
12
 
 
12
#
13
13
# This program is distributed in the hope that it will be useful,
14
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
16
# GNU General Public License for more details.
17
 
 
17
#
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
20
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
27
use lib dirname($RealBin)."/Kernel/cpan-lib";
28
28
 
29
29
use vars qw($VERSION);
30
 
$VERSION = '$Revision: 1.6 $';
 
30
$VERSION = '$Revision: 1.8 $';
31
31
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
32
32
 
33
33
use Kernel::Config;
34
34
use Kernel::System::Log;
35
35
 
36
 
# --
37
36
# common objects
38
 
# --
39
37
my %CommonObject = ();
40
38
$CommonObject{ConfigObject} = Kernel::Config->new();
41
39
$CommonObject{LogObject} = Kernel::System::Log->new(
42
40
    LogPrefix => 'otrs.getConfig',
43
41
    %CommonObject,
44
42
);
45
 
# --
 
43
 
46
44
# print wanted var
47
 
# --
48
45
my $Key = shift || '';
49
46
if ($Key) {
50
47
    chomp $Key;
65
62
    }
66
63
}
67
64
else {
68
 
    # --
69
65
    # print all vars
70
 
    # --
71
66
    foreach (sort keys %{$CommonObject{ConfigObject}}) {
72
 
      print $_.":";
73
 
      if (ref($CommonObject{ConfigObject}->{$_}) eq 'ARRAY') {
74
 
        foreach (@{$CommonObject{ConfigObject}->{$_}}) {
75
 
            print "$_;";
76
 
        }
77
 
        print "\n";
78
 
      }
79
 
      elsif (ref($CommonObject{ConfigObject}->{$_}) eq 'HASH') {
80
 
        foreach my $Key (sort keys %{$CommonObject{ConfigObject}->{$_}}) {
81
 
            print "$Key=$CommonObject{ConfigObject}->{$_}->{$Key};";
82
 
        }
83
 
        print "\n";
84
 
      }
85
 
      else {
86
 
        print $CommonObject{ConfigObject}->{$_}."\n";
87
 
      }
 
67
        print $_.":";
 
68
        if (ref($CommonObject{ConfigObject}->{$_}) eq 'ARRAY') {
 
69
            foreach (@{$CommonObject{ConfigObject}->{$_}}) {
 
70
                print "$_;";
 
71
            }
 
72
            print "\n";
 
73
        }
 
74
        elsif (ref($CommonObject{ConfigObject}->{$_}) eq 'HASH') {
 
75
            foreach my $Key (sort keys %{$CommonObject{ConfigObject}->{$_}}) {
 
76
                print "$Key=$CommonObject{ConfigObject}->{$_}->{$Key};";
 
77
            }
 
78
            print "\n";
 
79
        }
 
80
        else {
 
81
            print $CommonObject{ConfigObject}->{$_}."\n";
 
82
        }
88
83
    }
89
84
}