Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2008-08-19 05:22:09 +0400
committermattpiwik <matthieu.aubry@gmail.com>2008-08-19 05:22:09 +0400
commit08fdb96b420d832a8ce6141edff74f78181e25e2 (patch)
tree0c2fc60caa2116d72047d2541baf83aeb33ecc17
parent7e68e020a4416f66651465b752e97b70ca480d1c (diff)
Slightly improving interface for the database usage report
git-svn-id: http://dev.piwik.org/svn/trunk@617 59fd770c-687e-43c8-a1e3-f5a4ff64c105
-rw-r--r--plugins/DBStats/API.php37
-rw-r--r--plugins/DBStats/Controller.php2
-rw-r--r--plugins/DBStats/DBStats.php5
-rw-r--r--plugins/DBStats/templates/DBStats.tpl127
4 files changed, 49 insertions, 122 deletions
diff --git a/plugins/DBStats/API.php b/plugins/DBStats/API.php
index 562d620da9..b041b9a227 100644
--- a/plugins/DBStats/API.php
+++ b/plugins/DBStats/API.php
@@ -44,16 +44,21 @@ class Piwik_DBStats_API extends Piwik_Apiable
return $status;
}
- static private function get_size($size) {
- $bytes = array('','K','M','G','T');
- foreach($bytes as $val) {
- if($size > 1024){
- $size = $size / 1024;
- }else{
- break;
- }
- }
- return round($size, 1)." ".$val;
+ static private function get_size($size)
+ {
+ $bytes = array('','K','M','G','T');
+ foreach($bytes as $val)
+ {
+ if($size > 1024)
+ {
+ $size = $size / 1024;
+ }
+ else
+ {
+ break;
+ }
+ }
+ return round($size, 1)." ".$val;
}
static public function getTableStatus($table, $field = '')
@@ -79,16 +84,26 @@ class Piwik_DBStats_API extends Piwik_Apiable
$db = Zend_Registry::get('db');
// http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
$tablesPiwik = Piwik::getTablesInstalled();
+ $total = array('Name' => 'Total', 'Data_length' => 0, 'Index_length' => 0, 'Rows' => 0);
foreach($tablesPiwik as $table)
{
$t = self::getTableStatus($table);
+ $total['Data_length'] += $t['Data_length'];
+ $total['Index_length'] += $t['Index_length'];
+ $total['Rows'] += $t['Rows'];
+
+ $t['Total_length'] = self::get_size($t['Index_length']+$t['Data_length']);
$t['Data_length'] = self::get_size($t['Data_length']);
$t['Index_length'] = self::get_size($t['Index_length']);
$t['Rows'] = self::get_size($t['Rows']);
$tables[] = $t;
}
+ $total['Total_length'] = self::get_size($total['Data_length']+$total['Index_length']);
+ $total['Data_length'] = self::get_size($total['Data_length']);
+ $total['Index_length'] = self::get_size($total['Index_length']);
+ $total['TotalRows'] = self::get_size($total['Rows']);
+ $tables['Total'] = $total;
return $tables;
}
}
-
diff --git a/plugins/DBStats/Controller.php b/plugins/DBStats/Controller.php
index d12cc6e746..ec1e121252 100644
--- a/plugins/DBStats/Controller.php
+++ b/plugins/DBStats/Controller.php
@@ -19,4 +19,4 @@ class Piwik_DBStats_Controller extends Piwik_Controller
$view->menu = Piwik_GetAdminMenu();
echo $view->render();
}
-} \ No newline at end of file
+}
diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php
index c55155307a..c06304eae8 100644
--- a/plugins/DBStats/DBStats.php
+++ b/plugins/DBStats/DBStats.php
@@ -18,15 +18,16 @@ class Piwik_DBStats extends Piwik_Plugin
{
return array(
'name' => 'Databases statistics',
- 'description' => 'DBStats Plugin: This plugin returns database usage statistics.',
+ 'description' => 'This plugin reports the database usage by Piwik tables.',
'author' => 'Piwik',
'homepage' => 'http://piwik.org/',
'version' => '0.1',
);
}
+
function postLoad()
{
- Piwik_AddAdminMenu("Db", array('module' => 'DBStats', 'action' => 'index'));
+ Piwik_AddAdminMenu("Database usage", array('module' => 'DBStats', 'action' => 'index'));
}
}
\ No newline at end of file
diff --git a/plugins/DBStats/templates/DBStats.tpl b/plugins/DBStats/templates/DBStats.tpl
index a0ffaa326a..3b12605793 100644
--- a/plugins/DBStats/templates/DBStats.tpl
+++ b/plugins/DBStats/templates/DBStats.tpl
@@ -2,125 +2,36 @@
{assign var=showPeriodSelection value=false}
{include file="CoreAdminHome/templates/header.tpl"}
{include file="CoreAdminHome/templates/menu.tpl"}
-{literal}
-<style>
-.widefat {
- border-width: 1px;
- border-style: solid;
- border-collapse: collapse;
- width: 100%;
- clear: both;
- margin: 0;
-}
-
-.widefat a {
- text-decoration: none;
-}
-
-.widefat abbr {
- white-space: nowrap;
-}
-
-.widefat td, .widefat th {
- border-bottom-width: 1px;
- border-bottom-style: solid;
- border-bottom-color: #ccc;
- font-size: 11px;
- vertical-align: text-top;
-}
-
-.widefat td {
- padding: 7px 15px 9px 10px;
- vertical-align: top;
-}
-
-.widefat th {
- padding: 9px 15px 6px 10px;
- text-align: left;
- line-height: 1.3em;
-}
-
-.widefat th input {
- margin: 0 0 0 8px;
- padding: 0;
-}
-
-.widefat .check-column {
- text-align: right;
- width: 1.5em;
- padding: 0;
-
-}
-.widefat {
- border-color: #ccc;
-}
-
-.widefat tbody th.check-column {
- padding: 8px 0 22px;
-}
-.widefat .num {
- text-align: center;
-}
-.widefat td, .widefat th, div#available-widgets-filter, ul#widget-list li.widget-list-item, .commentlist li {
- border-bottom-color: #ccc;
-}
-
-.widefat thead, .thead {
- background-color: #464646;
- color: #d7d7d7;
-}
-
-.widefat td.action-links, .widefat th.action-links {
- text-align: right;
-}
-
-.widefat .name {
- font-weight: bold;
-}
-
-.widefat a {
- color:#2583AD;
-}
-
-.widefat .green {
- background-color: #ECF9DD;
-}
-
-
-</style>
-{/literal}
-
<div style="max-width:980px;">
-
-<h2>Databases management</h2>
-<p>Statistics about the primary database usage.</p>
-<table class="widefat">
+
+<h2>{'DBStats_DatabaseUsage'|translate}</h2>
+{assign var=totalSize value=$tablesStatus.Total.Total_length}
+<p>{'DBStats_MainDescription'|translate:$totalSize}</p>
+<table class="adminTable">
<thead>
- <tr>
- <th>Table</th>
- <th>Row number</th>
- <th>Size</th>
- <th>Index Size</th>
- <tbody id="tables">
+ <th>{'DBStats_Table'|translate}</th>
+ <th>{'DBStats_RowNumber'|translate}</th>
+ <th>{'DBStats_DataSize'|translate}</th>
+ <th>{'DBStats_IndexSize'|translate}</th>
+ </thead>
+ <tbody id="tables">
{foreach from=$tablesStatus key=index item=table}
- <tr class="active">
- <td class="green">
+ <tr {if $table.Name == 'Total'}class="active"{/if}>
+ <td>
{$table.Name}
</td>
- <td class="green">
+ <td>
{$table.Rows}
</td>
- <td class="green">
- {$table.Data_length}
+ <td>
+ {$table.Data_length}b
</td>
- <td class="green">
- {$table.Index_length}
+ <td>
+ {$table.Index_length}b
</td>
</tr>
{/foreach}
- </tr>
- </thead>
-
+ </tbody>
</table>
</div> \ No newline at end of file