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

« back to all changes in this revision

Viewing changes to bin/CheckDB.pl

  • 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
# CheckDB.pl - to check the db access
4
 
# Copyright (C) 2001-2004 Martin Edenhofer <martin+code@otrs.org>
 
4
# Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
5
5
# --
6
 
# $Id: CheckDB.pl,v 1.12 2004/12/04 18:28:59 martin Exp $
 
6
# $Id: CheckDB.pl,v 1.15 2006/09/25 13:24:21 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
30
30
use Getopt::Std;
31
31
 
32
32
use vars qw($VERSION);
33
 
$VERSION = '$Revision: 1.12 $';
 
33
$VERSION = '$Revision: 1.15 $';
34
34
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
35
35
 
36
36
use Kernel::Config;
37
37
use Kernel::System::Log;
 
38
use Kernel::System::Main;
38
39
use Kernel::System::DB;
39
 
#
40
 
# common objects
41
 
#  
42
 
my $ConfigObject = Kernel::Config->new();
43
 
my $LogObject = Kernel::System::Log->new(
 
40
 
 
41
# create common objects
 
42
my %CommonObject = ();
 
43
$CommonObject{ConfigObject} = Kernel::Config->new();
 
44
$CommonObject{LogObject} = Kernel::System::Log->new(
44
45
    LogPrefix => 'OTRS-CheckDB',
45
 
    ConfigObject => $ConfigObject,
46
 
);
47
 
my $DBObject = Kernel::System::DB->new(
48
 
    LogObject => $LogObject,
49
 
    ConfigObject => $ConfigObject,
50
 
);
51
 
 
46
    ConfigObject => $CommonObject{ConfigObject},
 
47
);
 
48
$CommonObject{MainObject} = Kernel::System::Main->new(%CommonObject);
 
49
$CommonObject{DBObject} = Kernel::System::DB->new(
 
50
    LogObject => $CommonObject{LogObject},
 
51
    ConfigObject => $CommonObject{ConfigObject},
 
52
);
 
53
 
52
54
# get options
53
 
54
55
my %Opts = ();
55
56
getopt('s',  \%Opts);
56
57
my $End = "\n";
57
58
if ($Opts{'s'}) {
58
59
    $End = '';
59
60
}
60
 
#
 
61
 
61
62
# chech database state
62
 
63
 
if ($DBObject) {
64
 
    $DBObject->Prepare(SQL => "SELECT * FROM valid");
 
63
if ($CommonObject{DBObject}) {
 
64
    $CommonObject{DBObject}->Prepare(SQL => "SELECT * FROM valid");
65
65
    my $Check = 0;
66
 
    while (my @RowTmp = $DBObject->FetchrowArray()) {
 
66
    while (my @RowTmp = $CommonObject{DBObject}->FetchrowArray()) {
67
67
        $Check++;
68
68
    }
69
69
    if (!$Check) {