[Rt-commit] rt branch, 4.2/checkintegrity-warnings, created. rt-4.0.6-335-gf16eef8
Alex Vandiver
alexmv at bestpractical.com
Thu Jun 7 23:17:23 EDT 2012
The branch, 4.2/checkintegrity-warnings has been created
at f16eef83a5e98b5bb3c2e060c72d63518af16109 (commit)
- Log -----------------------------------------------------------------
commit f16eef83a5e98b5bb3c2e060c72d63518af16109
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jun 7 23:13:32 2012 -0400
Avoid warnings if CheckIntegrity is called twice as a class method
CheckIntegrity constructs its own RT::Handle object if called as a class
method. However, this $self not only has an undef DSN, which generates
a warning, but is also misleading, as the DSN that actually failed to
connect is $RT::Handle's. Consistently use $RT::Handle, as that is what
RT::ConnecttoDatabase sets up, and what RT::CurrentUser looks up in.
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 43f8159..c77ad57 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -220,7 +220,6 @@ sub SystemDSN {
sub CheckIntegrity {
my $self = shift;
- $self = new $self unless ref $self;
unless ($RT::Handle and $RT::Handle->dbh) {
local $@;
@@ -233,13 +232,13 @@ sub CheckIntegrity {
my $test_user = RT::CurrentUser->new;
$test_user->Load('RT_System');
unless ( $test_user->id ) {
- return (0, 'no system user', "Couldn't find RT_System user in the DB '". $self->DSN ."'");
+ return (0, 'no system user', "Couldn't find RT_System user in the DB '". $RT::Handle->DSN ."'");
}
$test_user = RT::CurrentUser->new;
$test_user->Load('Nobody');
unless ( $test_user->id ) {
- return (0, 'no nobody user', "Couldn't find Nobody user in the DB '". $self->DSN ."'");
+ return (0, 'no nobody user', "Couldn't find Nobody user in the DB '". $RT::Handle->DSN ."'");
}
return $RT::Handle->dbh;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list