-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptimize.php
73 lines (66 loc) · 1.13 KB
/
optimize.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
include("lib/common.php");
AssertForbidden("optimize");
$rStats = Query("show table status");
while($stat = Fetch($rStats))
$tables[$stat['Name']] = $stat;
$tablelist = "";
$total = 0;
foreach($tables as $table)
{
$cellClass = ($cellClass+1) % 2;
$overhead = $table['Data_free'];
$total += $overhead;
$status = __("OK");
if($overhead > 0)
{
Query("OPTIMIZE TABLE `".$table['Name']."`");
$status = "<strong>".__("Optimized")."</strong>";
}
$tablelist .= format(
"
<tr class=\"cell{0}\">
<td class=\"cell2\">{1}</td>
<td>
{2}
</td>
<td>
{3}
</td>
<td>
{4}
</td>
</tr>
", $cellClass, $table['Name'], $table['Rows'], $overhead, $status);
}
write(
"
<table class=\"outline margin\">
<tr class=\"header0\">
<th colspan=\"7\">
".__("Table Status")."
</th>
</tr>
<tr class=\"header1\">
<th>
".__("Name")."
</th>
<th>
".__("Rows")."
</th>
<th>
".__("Overhead")."
</th>
<th>
".__("Final Status")."
</th>
</tr>
{0}
<tr class=\"header0\">
<th colspan=\"7\" style=\"font-size: 130%;\">
".__("Excess trimmed: {1} bytes")."
</th>
</tr>
</table>
", $tablelist, $total);
?>