[otrs-cvs] Support/Kernel/System/Support/Database mysql.pm, 1.34, 1.35

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/Support/Kernel/System/Support/Database
In directory lancelot:/tmp/cvs-serv7467/Kernel/System/Support/Database

Modified Files:
	mysql.pm 
Log Message:
Added tests for MySQL database to show the default storage engine, and to test if there are tables in the database with a different storage engine than the default.

Author: mb

Index: mysql.pm
===================================================================
RCS file: /home/cvs/Support/Kernel/System/Support/Database/mysql.pm,v
retrieving revision 1.34
retrieving revision 1.35
diff -2 -u -d -r1.34 -r1.35
--- mysql.pm	4 Sep 2012 04:07:50 -0000	1.34
+++ mysql.pm	23 Jan 2013 09:23:07 -0000	1.35
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/Support/Database/mysql.pm - all required system information
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -345,4 +345,58 @@
 }
 
+sub _StorageEngineCheck {
+    my ( $Self, %Param ) = @_;
+
+    $Self->{DBObject}->Prepare( SQL => "show variables where variable_name = 'storage_engine'" );
+    my $StorageEngine;
+    while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
+        $StorageEngine = $Row[1];
+    }
+    my $Data = {
+        Name        => $Self->{LanguageObject}->Get('Default Storage Engine'),
+        Description => $Self->{LanguageObject}->Get('Check Default Storage Engine.'),
+        Comment     => $Self->{LanguageObject}->Get('The default storage engine is')
+            . " $StorageEngine.",
+        Check => 'OK',
+    };
+    return $Data;
+}
+
+sub _TablesWithDifferentStorageEngineCheck {
+    my ( $Self, %Param ) = @_;
+
+    my $Check   = 'OK';
+    my $Comment = $Self->{LanguageObject}->Get('No tables found with different storage engine.');
+    $Self->{DBObject}->Prepare( SQL => "show variables where variable_name != 'storage_engine'" );
+    my $StorageEngine;
+    while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
+        $StorageEngine = $Row[1];
+    }
+
+    $Self->{DBObject}->Prepare(
+        SQL  => "show table status where engine = ?",
+        Bind => [ \$StorageEngine ],
+    );
+    my @Tables;
+    while ( my @Row = $Self->{DBObject}->FetchrowArray() ) {
+        push @Tables, $Row[0];
+    }
+
+    if (@Tables) {
+        $Check   = 'Failed';
+        $Comment = $Self->{LanguageObject}->Get('These tables use a different storage engine');
+        $Comment .= ': ' . join( ', ', @Tables );
+    }
+
+    my $Data = {
+        Name        => $Self->{LanguageObject}->Get('Tables with different storage engine'),
+        Description => $Self->{LanguageObject}
+            ->Get('Test if there are tables with a different storage engine.'),
+        Comment => $Comment,
+        Check   => $Check,
+    };
+    return $Data;
+}
+
 sub _CurrentTimestampCheck {
     my ( $Self, %Param ) = @_;
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.