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/
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 $
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
32
32
use vars qw($VERSION);
33
$VERSION = '$Revision: 1.12 $';
33
$VERSION = '$Revision: 1.15 $';
34
34
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
36
36
use Kernel::Config;
37
37
use Kernel::System::Log;
38
use Kernel::System::Main;
38
39
use Kernel::System::DB;
42
my $ConfigObject = Kernel::Config->new();
43
my $LogObject = Kernel::System::Log->new(
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,
47
my $DBObject = Kernel::System::DB->new(
48
LogObject => $LogObject,
49
ConfigObject => $ConfigObject,
46
ConfigObject => $CommonObject{ConfigObject},
48
$CommonObject{MainObject} = Kernel::System::Main->new(%CommonObject);
49
$CommonObject{DBObject} = Kernel::System::DB->new(
50
LogObject => $CommonObject{LogObject},
51
ConfigObject => $CommonObject{ConfigObject},
55
56
getopt('s', \%Opts);
61
62
# chech database state
64
$DBObject->Prepare(SQL => "SELECT * FROM valid");
63
if ($CommonObject{DBObject}) {
64
$CommonObject{DBObject}->Prepare(SQL => "SELECT * FROM valid");
66
while (my @RowTmp = $DBObject->FetchrowArray()) {
66
while (my @RowTmp = $CommonObject{DBObject}->FetchrowArray()) {