1<?php 2# MantisBT - A PHP based bugtracking system 3 4# MantisBT is free software: you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation, either version 2 of the License, or 7# (at your option) any later version. 8# 9# MantisBT is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with MantisBT. If not, see <http://www.gnu.org/licenses/>. 16 17/** 18 * Display Database Statistics - Currently Row Count for each table. 19 * 20 * @package MantisBT 21 * @copyright Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org 22 * @copyright Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net 23 * @link http://www.mantisbt.org 24 */ 25 26require_once( dirname( dirname( __FILE__ ) ) . '/core.php' ); 27 28access_ensure_global_level( config_get_global( 'admin_site_threshold' ) ); 29 30layout_page_header(); 31 32layout_admin_page_begin(); 33 34/** 35 * Output HTML Table Row 36 * 37 * @param string $p_description Row Description. 38 * @param string $p_value Row Value. 39 * @return void 40 */ 41function print_info_row( $p_description, $p_value ) { 42 echo '<tr>'; 43 echo '<td class="category">' . $p_description . '</td>'; 44 echo '<td>' . $p_value . '</td>'; 45 echo '</tr>'; 46} 47 48/** 49 * Function to get row count for a given table 50 * 51 * @param string $p_table Table name. 52 * @return integer row count 53 */ 54function helper_table_row_count( $p_table ) { 55 $t_table = $p_table; 56 $t_query = 'SELECT COUNT(*) FROM ' . $t_table; 57 $t_result = db_query( $t_query ); 58 $t_count = db_result( $t_result ); 59 60 return $t_count; 61} 62?> 63<div class="col-md-12 col-xs-12"> 64<div class="space-10"></div> 65<div class="widget-box widget-color-blue2"> 66<div class="widget-header widget-header-small"> 67<h4 class="widget-title lighter"> 68 <?php print_icon( 'fa-database', 'ace-icon' ); ?> 69 <?php echo lang_get( 'mantisbt_database_statistics' ) ?> 70</h4> 71</div> 72 73<div class="widget-body"> 74<div class="widget-main no-padding"> 75<div class="table-responsive"> 76<table class="table table-bordered table-striped table-condensed table-hover"> 77 <thead> 78 <tr class="row-category"> 79 <th>Table Name</th> 80 <th>Record Count</th> 81 </tr> 82 <thead> 83 <tbody> 84<?php 85foreach( db_get_table_list() as $t_table ) { 86 if( db_table_exists( $t_table ) ) { 87 print_info_row( $t_table, helper_table_row_count( $t_table ) ); 88 } 89} 90?> 91 </tbody> 92</table> 93</div> 94</div> 95</div> 96</div> 97</div> 98 99<?php 100layout_admin_page_end();