@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | // returns formatted data size |
44 | -function size_format($size){ |
|
44 | +function size_format($size) { |
|
45 | 45 | $retval = 0; |
46 | 46 | |
47 | 47 | $KB = 1024; |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | if ($size < $KB) { |
53 | 53 | $retval = $size; |
54 | 54 | } elseif (($size > $KB) && ($size < $MB)) { |
55 | - $retval = sprintf("%.0fK", ($size / $KB)); |
|
56 | - } elseif ( ($size >= $MB) && ($size < $GB)) { |
|
57 | - $retval = sprintf("%.2fMB", ($size / $MB)); |
|
58 | - } elseif ( ($size >= $GB) && ($size < $TB)) { |
|
59 | - $retval = sprintf("%.2fGB", ($size / $GB)); |
|
60 | - } elseif ( $size >= $TB ) { |
|
61 | - $retval = sprintf("%.2fTB", ($size / $TB)); |
|
55 | + $retval = sprintf("%.0fK", ($size/$KB)); |
|
56 | + } elseif (($size >= $MB) && ($size < $GB)) { |
|
57 | + $retval = sprintf("%.2fMB", ($size/$MB)); |
|
58 | + } elseif (($size >= $GB) && ($size < $TB)) { |
|
59 | + $retval = sprintf("%.2fGB", ($size/$GB)); |
|
60 | + } elseif ($size >= $TB) { |
|
61 | + $retval = sprintf("%.2fTB", ($size/$TB)); |
|
62 | 62 | } |
63 | 63 | return $retval; |
64 | 64 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | if ($myarr['Comment'] == 'VIEW') continue; |
90 | 90 | |
91 | 91 | // sum grand totals |
92 | - $total = $myarr["Data_length"] + $myarr["Index_length"]; |
|
92 | + $total = $myarr["Data_length"] + $myarr["Index_length"]; |
|
93 | 93 | $gindex += $myarr["Index_length"]; |
94 | - $gdata += $myarr["Data_length"]; |
|
94 | + $gdata += $myarr["Data_length"]; |
|
95 | 95 | $grows += $myarr["Rows"]; |
96 | 96 | $gtotal += $total; |
97 | 97 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ); |
106 | 106 | $i++; |
107 | 107 | } |
108 | - $db_rec[$i] = new DB_REC ("Total", $gdata, $gindex, $gtotal, $grows, "" ); |
|
108 | + $db_rec[$i] = new DB_REC("Total", $gdata, $gindex, $gtotal, $grows, ""); |
|
109 | 109 | return $db_rec; |
110 | 110 | } |
111 | 111 | |
@@ -126,25 +126,25 @@ discard block |
||
126 | 126 | echo "<th>Avg. Size per Row</th>"; |
127 | 127 | echo "</tr>"; |
128 | 128 | |
129 | - for ($i = 0; $i < sizeof($db_rec)-1; $i++){ |
|
129 | + for ($i = 0; $i < sizeof($db_rec) - 1; $i++) { |
|
130 | 130 | echo "<tr>"; |
131 | - echo "<td align=left valign=top class=fieldname>" . $db_rec[$i]->name . "</td>"; |
|
132 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->data_size) . "</td>"; |
|
133 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->index_size) . "</td>"; |
|
134 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->total_size) . "</td>"; |
|
135 | - echo "<td align=left valign=top class=fieldname>" . number_format($db_rec[$i]->rows) . "</td>"; |
|
136 | - echo "<td align=left valign=top class=fieldname>" . size_format($db_rec[$i]->size_per_row) . "</td>"; |
|
131 | + echo "<td align=left valign=top class=fieldname>".$db_rec[$i]->name."</td>"; |
|
132 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->data_size)."</td>"; |
|
133 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->index_size)."</td>"; |
|
134 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->total_size)."</td>"; |
|
135 | + echo "<td align=left valign=top class=fieldname>".number_format($db_rec[$i]->rows)."</td>"; |
|
136 | + echo "<td align=left valign=top class=fieldname>".size_format($db_rec[$i]->size_per_row)."</td>"; |
|
137 | 137 | echo "</tr>"; |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Last record is just a summary |
141 | - $i = sizeof($db_rec)-1; |
|
141 | + $i = sizeof($db_rec) - 1; |
|
142 | 142 | echo "<tr>"; |
143 | - echo "<th align=left>" . $db_rec[$i]->name . "</th>"; |
|
144 | - echo "<th align=left>" . size_format($db_rec[$i]->data_size) . "</th>"; |
|
145 | - echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>"; |
|
146 | - echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>"; |
|
147 | - echo "<th align=left>" . number_format($db_rec[$i]->rows) . "</th>"; |
|
143 | + echo "<th align=left>".$db_rec[$i]->name."</th>"; |
|
144 | + echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>"; |
|
145 | + echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>"; |
|
146 | + echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>"; |
|
147 | + echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>"; |
|
148 | 148 | echo "<th align=left></th>"; |
149 | 149 | echo "</tr>"; |
150 | 150 | echo "</table>"; |
@@ -156,28 +156,28 @@ discard block |
||
156 | 156 | $file_list = array(); |
157 | 157 | $file_sort = array(); |
158 | 158 | |
159 | - $sort = get_str("sort", true); |
|
159 | + $sort = get_str("sort", true); |
|
160 | 160 | $r = get_str("r", true); |
161 | 161 | |
162 | 162 | if (empty($sort)) $sort = "name"; |
163 | 163 | // check for allowed keys |
164 | - if ((strcmp($sort, "name")!=0) && |
|
165 | - (strcmp($sort, "data_size")!=0) && |
|
166 | - (strcmp($sort, "index_size")!=0) && |
|
167 | - (strcmp($sort, "total_size")!=0) && |
|
168 | - (strcmp($sort, "rows")!=0) && |
|
169 | - (strcmp($sort, "size_per_row")!=0) |
|
164 | + if ((strcmp($sort, "name") != 0) && |
|
165 | + (strcmp($sort, "data_size") != 0) && |
|
166 | + (strcmp($sort, "index_size") != 0) && |
|
167 | + (strcmp($sort, "total_size") != 0) && |
|
168 | + (strcmp($sort, "rows") != 0) && |
|
169 | + (strcmp($sort, "size_per_row") != 0) |
|
170 | 170 | ) { |
171 | 171 | $sort = "name"; |
172 | 172 | } |
173 | - if (empty($r)) $r=0; |
|
173 | + if (empty($r)) $r = 0; |
|
174 | 174 | |
175 | - for ($i=0; $i < sizeof($db_rec)-1; $i++){ |
|
175 | + for ($i = 0; $i < sizeof($db_rec) - 1; $i++) { |
|
176 | 176 | $file_details["name"] = $db_rec[$i]->name; |
177 | 177 | $file_details["data_size"] = $db_rec[$i]->data_size; |
178 | 178 | $file_details["index_size"] = $db_rec[$i]->index_size; |
179 | 179 | $file_details["total_size"] = $db_rec[$i]->total_size; |
180 | - $file_details["rows"] = $db_rec[$i]->rows; |
|
180 | + $file_details["rows"] = $db_rec[$i]->rows; |
|
181 | 181 | $file_details["size_per_row"] = $db_rec[$i]->size_per_row; |
182 | 182 | |
183 | 183 | $file_list[$i] = $file_details; |
@@ -197,35 +197,35 @@ discard block |
||
197 | 197 | echo "</tr>"; |
198 | 198 | |
199 | 199 | echo "<tr>"; |
200 | - echo "<th><a href='dbinfo.php?sort=name&r=" . (!$r) . "'>Table </a></th>"; |
|
201 | - echo "<th><a href='dbinfo.php?sort=data_size&r=" . (!$r) . "'>Data Size</a></th>"; |
|
202 | - echo "<th><a href='dbinfo.php?sort=index_size&r=" . (!$r) . "'>Index Size</a></th>"; |
|
203 | - echo "<th><a href='dbinfo.php?sort=total_size&r=" . (!$r) . "'>Total Size</a></th>"; |
|
204 | - echo "<th><a href='dbinfo.php?sort=rows&r=" . (!$r) . "'>Total Rows</a></th>"; |
|
205 | - echo "<th><a href='dbinfo.php?sort=size_per_row&r=" . (!$r) . "'>Avg. Size per Row</a></th>"; |
|
200 | + echo "<th><a href='dbinfo.php?sort=name&r=".(!$r)."'>Table </a></th>"; |
|
201 | + echo "<th><a href='dbinfo.php?sort=data_size&r=".(!$r)."'>Data Size</a></th>"; |
|
202 | + echo "<th><a href='dbinfo.php?sort=index_size&r=".(!$r)."'>Index Size</a></th>"; |
|
203 | + echo "<th><a href='dbinfo.php?sort=total_size&r=".(!$r)."'>Total Size</a></th>"; |
|
204 | + echo "<th><a href='dbinfo.php?sort=rows&r=".(!$r)."'>Total Rows</a></th>"; |
|
205 | + echo "<th><a href='dbinfo.php?sort=size_per_row&r=".(!$r)."'>Avg. Size per Row</a></th>"; |
|
206 | 206 | echo "</tr>"; |
207 | 207 | |
208 | 208 | foreach ($file_sort as $key=>$value) { |
209 | 209 | $value = $file_list[$key]; |
210 | 210 | |
211 | 211 | echo "<tr>"; |
212 | - echo "<td align=left valign=top class=fieldname>" . $value["name"] . "</td>"; |
|
213 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["data_size"]) . "</td>"; |
|
214 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["index_size"]) . "</td>"; |
|
215 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["total_size"]) . "</td>"; |
|
216 | - echo "<td align=left valign=top class=fieldname>" . number_format($value["rows"]) . "</td>"; |
|
217 | - echo "<td align=left valign=top class=fieldname>" . size_format($value["size_per_row"]) . "</td>"; |
|
212 | + echo "<td align=left valign=top class=fieldname>".$value["name"]."</td>"; |
|
213 | + echo "<td align=left valign=top class=fieldname>".size_format($value["data_size"])."</td>"; |
|
214 | + echo "<td align=left valign=top class=fieldname>".size_format($value["index_size"])."</td>"; |
|
215 | + echo "<td align=left valign=top class=fieldname>".size_format($value["total_size"])."</td>"; |
|
216 | + echo "<td align=left valign=top class=fieldname>".number_format($value["rows"])."</td>"; |
|
217 | + echo "<td align=left valign=top class=fieldname>".size_format($value["size_per_row"])."</td>"; |
|
218 | 218 | echo "</tr>"; |
219 | 219 | } |
220 | 220 | |
221 | 221 | // Last record is a summary |
222 | - $i = sizeof($db_rec)-1; |
|
222 | + $i = sizeof($db_rec) - 1; |
|
223 | 223 | echo "<tr>"; |
224 | - echo "<th align=left>" . $db_rec[$i]->name . "</th>"; |
|
225 | - echo "<th align=left>" . size_format($db_rec[$i]->data_size) . "</th>"; |
|
226 | - echo "<th align=left>" . size_format($db_rec[$i]->index_size) . "</th>"; |
|
227 | - echo "<th align=left>" . size_format($db_rec[$i]->total_size) . "</th>"; |
|
228 | - echo "<th align=left>" . number_format($db_rec[$i]->rows) . "</th>"; |
|
224 | + echo "<th align=left>".$db_rec[$i]->name."</th>"; |
|
225 | + echo "<th align=left>".size_format($db_rec[$i]->data_size)."</th>"; |
|
226 | + echo "<th align=left>".size_format($db_rec[$i]->index_size)."</th>"; |
|
227 | + echo "<th align=left>".size_format($db_rec[$i]->total_size)."</th>"; |
|
228 | + echo "<th align=left>".number_format($db_rec[$i]->rows)."</th>"; |
|
229 | 229 | echo "<th align=left></th>"; |
230 | 230 | echo "</tr>"; |
231 | 231 |