[otrs-cvs] otrs/bin otrs.CheckDB.pl,1.11,1.12

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

Modified Files:
	otrs.CheckDB.pl 
Log Message:
Added test to check if there are problems with the storage type on MySQL tables.

Author: mb

Index: otrs.CheckDB.pl
===================================================================
RCS file: /home/cvs/otrs/bin/otrs.CheckDB.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -2 -u -d -r1.11 -r1.12
--- otrs.CheckDB.pl	22 Jan 2013 10:14:09 -0000	1.11
+++ otrs.CheckDB.pl	24 Jan 2013 07:27:36 -0000	1.12
@@ -71,4 +71,34 @@
     else {
         print "Connected.\n";
+
+        # check for common MySQL issue where default storage engine is different
+        # from initial OTRS table; this can happen when MySQL is upgraded from
+        # 5.1 > 5.5.
+        if ( $CommonObject{DBObject}->{'DB::Type'} eq 'mysql' ) {
+            $CommonObject{DBObject}->Prepare(
+                SQL => "SHOW VARIABLES WHERE variable_name = 'storage_engine'",
+            );
+            my $StorageEngine;
+            while ( my @Row = $CommonObject{DBObject}->FetchrowArray() ) {
+                $StorageEngine = $Row[1];
+            }
+            $CommonObject{DBObject}->Prepare(
+                SQL  => "SHOW TABLE STATUS WHERE engine != ?",
+                Bind => [ \$StorageEngine ],
+            );
+            my @Tables;
+            while ( my @Row = $CommonObject{DBObject}->FetchrowArray() ) {
+                push @Tables, $Row[0];
+            }
+            if (@Tables) {
+                print "Your storage engine is $StorageEngine.\n";
+                print "These tables use a different storage engine:\n\n";
+                print join( "\n", sort @Tables );
+                print "\n\n *** Please correct these problems! *** \n\n";
+
+                exit(1);
+            }
+        }
+
         exit(0);
     }
---------------------------------------------------------------------
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.