assoc_buttons(array( 'form' => array( 'name' => '', 'process' => 'display_form', 'check' => 'a_')) ); $result = $db->query('SELECT VERSION() AS mysql_version'); if ( $row = $db->fetch_record($result) ) { $this->mysql_version = $row['mysql_version']; } } // --------------------------------------------------------- // Display form // --------------------------------------------------------- function display_form() { global $db, $eqdkp, $user, $tpl, $pm; global $SID, $dbname, $table_prefix; if ( preg_match('/^(3\.23|4\.)/', $this->mysql_version) ) { $db_name = ( preg_match('/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/', $this->mysql_version) ) ? "`$dbname`" : $dbname; // Get table status $sql = 'SHOW TABLE STATUS FROM ' . $db_name; $result = $db->query($sql); $dbsize = 0; while ( $row = $db->fetch_record($result) ) { if ( $row['Type'] != 'MRG_MyISAM' ) { if ( $table_prefix != '' ) { // Current row is an EQdkp table, get info for it if ( strstr($row['Name'], $table_prefix) ) { $tpl->assign_block_vars('table_row', array( 'ROW_CLASS' => $eqdkp->switch_row_class(), 'TABLE_NAME' => $row['Name'], 'ROWS' => number_format($row['Rows'], ','), 'TABLE_SIZE' => $this->db_size($row['Data_length']), 'INDEX_SIZE' => $this->db_size($row['Index_length'])) ); $this->num_tables++; $this->table_size += $row['Data_length']; $this->index_size += $row['Index_length']; } // name match } // table_prefix != '' } // type != MRG_MyISAM } // while $tpl->assign_vars(array( 'NUM_TABLES' => sprintf($user->lang['num_tables'], $this->num_tables), 'TOTAL_TABLE_SIZE' => $this->db_size($this->table_size), 'TOTAL_INDEX_SIZE' => $this->db_size($this->index_size), 'TOTAL_SIZE' => $this->db_size($this->table_size + $this->index_size), 'L_EQDKP_TABLES' => $user->lang['eqdkp_tables'], 'L_TABLE_NAME' => $user->lang['table_name'], 'L_ROWS' => $user->lang['rows'], 'L_TABLE_SIZE' => $user->lang['table_size'], 'L_INDEX_SIZE' => $user->lang['index_size'], 'L_TOTALS' => $user->lang['totals']) ); $eqdkp->set_vars(array( 'page_title' => 'MySQL Info', 'template_file' => 'admin/mysql_info.html', 'display' => true) ); } // version match } function db_size($size) { if ( $size >= 1048576 ) { return sprintf('%.2f MB', ($size / 1048576)); } elseif ( $size >= 1024 ) { return sprintf('%.2f KB', ($size / 1024)); } else { return sprintf('%.2f B', $size); } } } $info = new MySQL_Info; $info->process(); ?>