File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ public function checkAction()
32
32
33
33
$ tablesError = [];
34
34
$ columnsError = [];
35
+ $ innodbError = [];
35
36
36
37
foreach ($ results ->toArray () as $ result ) {
37
38
$ tableName = array_shift ($ result );
@@ -44,10 +45,13 @@ public function checkAction()
44
45
45
46
46
47
foreach ($ res ->toArray () as $ params ) {
47
-
48
48
if ($ params ['Collation ' ] && $ params ['Collation ' ] != 'utf8_general_ci ' ) {
49
49
$ tablesError [$ tableName ] = $ params ['Collation ' ];
50
50
}
51
+
52
+ if ($ params ['Engine ' ] && $ params ['Engine ' ] != 'InnoDB ' ) {
53
+ $ innodbError [$ tableName ] = $ params ['Engine ' ];
54
+ }
51
55
}
52
56
53
57
$ sql
@@ -66,5 +70,18 @@ public function checkAction()
66
70
67
71
$ this ->view ()->assign ('columnsError ' , $ columnsError );
68
72
$ this ->view ()->assign ('tablesError ' , $ tablesError );
73
+ $ this ->view ()->assign ('innodbError ' , $ innodbError );
74
+ }
75
+
76
+ public function migrateAction ()
77
+ {
78
+ $ table = $ this ->params ('table ' );
79
+
80
+ if ($ table ){
81
+ $ sql = "ALTER TABLE $ table ENGINE=InnoDB; " ;
82
+ Pi::db ()->getAdapter ()->query ($ sql , 'execute ' );
83
+ }
84
+
85
+ $ this ->redirect ()->toRoute ('' , ['action ' => 'check ' ]);
69
86
}
70
87
}
Original file line number Diff line number Diff line change 15
15
</a>
16
16
</div>
17
17
<div class="row">
18
- <div class="col-md-6 ">
18
+ <div class="col-md-4 ">
19
19
<div class="panel panel-default">
20
20
<div class="panel-heading">
21
21
<?php echo _a ('Results for tables ' ); ?>
25
25
</div>
26
26
</div>
27
27
</div>
28
- <div class="col-md-6 ">
28
+ <div class="col-md-4 ">
29
29
<div class="panel panel-default">
30
30
<div class="panel-heading">
31
31
<?php echo _a ('Results for columns ' ); ?>
35
35
</div>
36
36
</div>
37
37
</div>
38
+ <div class="col-md-4">
39
+ <div class="panel panel-default">
40
+ <div class="panel-heading">
41
+ <?php echo _a ('Results for InnoDB check ' ); ?>
42
+ </div>
43
+ <div class="panel-body">
44
+ <ul>
45
+ <?php foreach ($ innodbError as $ tableName => $ tableType ) : ?>
46
+ <li><?php echo $ tableName ?> (<?php echo $ tableType ?> ) => <a href="<?php echo $ this ->url ('' , ['action ' => 'migrate ' ]); ?> ?table=<?php echo $ tableName ?> ">InnoDB</a></li>
47
+ <?php endforeach ; ?>
48
+ </ul>
49
+ </div>
50
+ </div>
51
+ </div>
38
52
</div>
39
53
</div>
Original file line number Diff line number Diff line change 21
21
<div class="col-md-3 text-right">
22
22
<a href="<?php echo $ this ->url ('' , ['action ' => 'check ' ]); ?> " class="btn btn-primary btn-sm">
23
23
<i class="fa fa-cog" aria-hidden="true"></i>
24
- <?php echo _a ('Check UTF8 ' ); ?>
24
+ <?php echo _a ('Check UTF8 and Innodb ' ); ?>
25
25
</a>
26
26
</div>
27
27
</div>
You can’t perform that action at this time.
0 commit comments