本文整理汇总了PHP中PMA_formatByteDown函数的典型用法代码示例。如果您正苦于以下问题:PHP PMA_formatByteDown函数的具体用法?PHP PMA_formatByteDown怎么用?PHP PMA_formatByteDown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMA_formatByteDown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_generateEngineDetails
function PMA_generateEngineDetails($variables, $like = NULL, $indent = 0)
{
global $cfg;
$spaces = '';
for ($i = 0; $i < $indent; $i++) {
$spaces .= ' ';
}
/**
* Get the variables!
*/
if (!empty($variables)) {
$sql_query = 'SHOW ' . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '') . 'VARIABLES' . (empty($like) ? '' : ' LIKE \'' . $like . '\'') . ';';
$res = PMA_DBI_query($sql_query);
$mysql_vars = array();
while ($row = PMA_DBI_fetch_row($res)) {
if (isset($variables[$row[0]])) {
$mysql_vars[$row[0]] = $row[1];
}
}
PMA_DBI_free_result($res);
unset($res, $row, $sql_query);
}
if (empty($mysql_vars)) {
return $spaces . '<p>' . "\n" . $spaces . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . $spaces . '</p>' . "\n";
}
$dt_table = $spaces . '<table>' . "\n";
$useBgcolorOne = TRUE;
$has_content = FALSE;
foreach ($variables as $var => $details) {
if (!isset($mysql_vars[$var])) {
continue;
}
if (!isset($details['type'])) {
$details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
}
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
$bgcolor = $useBgcolorOne ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
$dt_table .= $spaces . ' <tr>' . "\n" . $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n";
if (!empty($variables[$var]['desc'])) {
$dt_table .= $spaces . ' ' . PMA_showHint($details['desc']) . "\n";
}
$dt_table .= $spaces . ' </td>' . "\n" . $spaces . ' <td bgcolor="' . $bgcolor . '">' . "\n" . $spaces . ' ' . $details['title'] . ' ' . "\n" . $spaces . ' </td>' . "\n" . $spaces . ' <td bgcolor="' . $bgcolor . '"' . ($is_num ? ' align="right"' : '') . '>' . "\n" . $spaces . ' ';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
unset($parsed_size);
break;
default:
$dt_table .= htmlspecialchars($mysql_vars[$var]);
}
$dt_table .= ' ' . "\n" . $spaces . ' </td>' . "\n" . $spaces . ' </tr>' . "\n";
$useBgcolorOne = !$useBgcolorOne;
$has_content = TRUE;
}
if (!$has_content) {
return '';
}
return $dt_table;
}
示例2: getPage
function getPage($id)
{
global $cfg;
switch ($id) {
case 'bufferpool':
if (PMA_MYSQL_INT_VERSION < 50002) {
return FALSE;
}
// rabus: The following query is only possible because we know
// that we are on MySQL 5 here (checked above)!
// side note: I love MySQL 5 for this. :-)
$res = PMA_DBI_query('SHOW STATUS WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\' OR Variable_name = \'Innodb_page_size\';');
$status = array();
while ($row = PMA_DBI_fetch_row($res)) {
$status[$row[0]] = $row[1];
}
PMA_DBI_free_result($res);
unset($res, $row);
$output = '<table>' . "\n" . ' <thead>' . "\n" . ' <tr>' . "\n" . ' <th colspan="4">' . "\n" . ' ' . $GLOBALS['strBufferPoolUsage'] . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </thead>' . "\n" . ' <tfoot>' . "\n" . ' <tr>' . "\n" . ' <th>' . "\n" . ' ' . $GLOBALS['strTotalUC'] . "\n" . ' </th>' . "\n" . ' <th colspan="3">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_total']) . ' ' . $GLOBALS['strInnoDBPages'] . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </tfoot>' . "\n" . ' <tbody>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strFreePages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_free']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strDirtyPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_dirty']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strDataPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_data']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strPagesToBeFlushed'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_flushed']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strBusyPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_misc']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strLatchedPages'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_pages_latched']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n\n" . '<br />' . "\n\n" . '<table>' . "\n" . ' <thead>' . "\n" . ' <tr>' . "\n" . ' <th colspan="4">' . "\n" . ' ' . $GLOBALS['strBufferPoolActivity'] . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </thead>' . "\n" . ' <tbody>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strReadRequests'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_read_requests']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strWriteRequests'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_write_requests']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strBufferReadMisses'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_reads']) . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . $GLOBALS['strBufferWriteWaits'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . htmlspecialchars($status['Innodb_buffer_pool_wait_free']) . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' <tr>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strBufferReadMissesInPercent'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n" . ' </td>' . "\n" . ' <td bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n" . ' ' . $GLOBALS['strBufferWriteWaitsInPercent'] . ' ' . "\n" . ' </td>' . "\n" . ' <td align="right" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n" . ' ' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(number_format($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 2, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator'])) . ' %') . "\n" . ' </td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n";
return $output;
case 'status':
$res = PMA_DBI_query('SHOW INNODB STATUS;');
$row = PMA_DBI_fetch_row($res);
PMA_DBI_free_result($res);
return '<pre>' . "\n" . htmlspecialchars($row[0]) . "\n" . '</pre>' . "\n";
default:
return FALSE;
}
}
示例3: PMA_buildHtmlForDb
function PMA_buildHtmlForDb($current, $is_superuser, $checkall, $url_query, $column_order, $replication_types, $replication_info)
{
$out = '';
if ($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) {
$out .= '<td class="tool">';
$out .= '<input type="checkbox" name="selected_dbs[]" title="' . htmlspecialchars($current['SCHEMA_NAME']) . '" value="' . htmlspecialchars($current['SCHEMA_NAME']) . '" ';
if ($current['SCHEMA_NAME'] != 'mysql' && $current['SCHEMA_NAME'] != 'information_schema') {
$out .= (empty($checkall) ? '' : 'checked="checked" ') . '/>';
} else {
$out .= ' disabled="disabled" />';
}
$out .= '</td>';
}
$out .= '<td class="name">' . ' <a onclick="' . 'if (window.parent.openDb && window.parent.openDb(\'' . PMA_jsFormat($current['SCHEMA_NAME'], false) . '\')) return false;' . '" href="index.php?' . $url_query . '&db=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Jump to database'), htmlspecialchars($current['SCHEMA_NAME'])) . '" target="_parent">' . ' ' . htmlspecialchars($current['SCHEMA_NAME']) . '</a>' . '</td>';
foreach ($column_order as $stat_name => $stat) {
if (array_key_exists($stat_name, $current)) {
if (is_numeric($stat['footer'])) {
$column_order[$stat_name]['footer'] += $current[$stat_name];
}
if ($stat['format'] === 'byte') {
list($value, $unit) = PMA_formatByteDown($current[$stat_name], 3, 1);
} elseif ($stat['format'] === 'number') {
$value = PMA_formatNumber($current[$stat_name], 0);
} else {
$value = htmlentities($current[$stat_name], 0);
}
$out .= '<td class="value">';
if (isset($stat['description_function'])) {
$out .= '<dfn title="' . $stat['description_function']($current[$stat_name]) . '">';
}
$out .= $value;
if (isset($stat['description_function'])) {
$out .= '</dfn>';
}
$out .= '</td>';
if ($stat['format'] === 'byte') {
$out .= '<td class="unit">' . $unit . '</td>';
}
}
}
foreach ($replication_types as $type) {
if ($replication_info[$type]['status']) {
$out .= '<td class="tool" style="text-align: center;">';
if (strlen(array_search($current["SCHEMA_NAME"], $replication_info[$type]['Ignore_DB'])) > 0) {
$out .= PMA_getIcon('s_cancel.png', __('Not replicated'));
} else {
$key = array_search($current["SCHEMA_NAME"], $replication_info[$type]['Do_DB']);
if (strlen($key) > 0 || $replication_info[$type]['Do_DB'][0] == "" && count($replication_info[$type]['Do_DB']) == 1) {
// if ($key != null) did not work for index "0"
$out .= PMA_getIcon('s_success.png', __('Replicated'));
}
}
$out .= '</td>';
}
}
if ($is_superuser) {
$out .= '<td class="tool">' . '<a onclick="' . 'if (window.parent.setDb) window.parent.setDb(\'' . PMA_jsFormat($current['SCHEMA_NAME']) . '\');' . '" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['SCHEMA_NAME']) . '" title="' . sprintf(__('Check privileges for database "%s".'), htmlspecialchars($current['SCHEMA_NAME'])) . '">' . ' ' . PMA_getIcon('s_rights.png', __('Check Privileges')) . '</a></td>';
}
return array($column_order, $out);
}
示例4: PMA_generateEngineDetails
/**
* Function for displaying the table of an engine's parameters
*
* @param array List of MySQL variables and corresponding localized descriptions.
* The array elements should have the following format:
* $variable => array('title' => $title, 'desc' => $description);
* @param string Prefix for the SHOW VARIABLES query.
* @return string The table that was generated based on the given information.
*/
function PMA_generateEngineDetails($variables, $like = null)
{
/**
* Get the variables!
*/
if (!empty($variables)) {
$sql_query = 'SHOW ' . (PMA_MYSQL_INT_VERSION >= 40102 ? 'GLOBAL ' : '') . 'VARIABLES' . (empty($like) ? '' : ' LIKE \'' . $like . '\'') . ';';
$res = PMA_DBI_query($sql_query);
$mysql_vars = array();
while ($row = PMA_DBI_fetch_row($res)) {
if (isset($variables[$row[0]])) {
$mysql_vars[$row[0]] = $row[1];
}
}
PMA_DBI_free_result($res);
unset($res, $row, $sql_query);
}
if (empty($mysql_vars)) {
return '<p>' . "\n" . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . '</p>' . "\n";
}
$dt_table = '<table class="data" cellspacing="1">' . "\n";
$odd_row = false;
$has_content = false;
foreach ($variables as $var => $details) {
if (!isset($mysql_vars[$var])) {
continue;
}
if (!isset($details['type'])) {
$details['type'] = PMA_ENGINE_DETAILS_TYPE_PLAINTEXT;
}
$is_num = $details['type'] == PMA_ENGINE_DETAILS_TYPE_SIZE || $details['type'] == PMA_ENGINE_DETAILS_TYPE_NUMERIC;
$dt_table .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . ' <td>' . "\n";
if (!empty($variables[$var]['desc'])) {
$dt_table .= ' ' . PMA_showHint($details['desc']) . "\n";
}
$dt_table .= ' </td>' . "\n" . ' <th>' . htmlspecialchars(empty($details['title']) ? $var : $details['title']) . "\n" . ' </th>' . "\n" . ' <td class="value">';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($mysql_vars[$var]);
$dt_table .= $parsed_size[0] . ' ' . $parsed_size[1];
unset($parsed_size);
break;
case PMA_ENGINE_DETAILS_TYPE_NUMERIC:
$dt_table .= PMA_formatNumber($mysql_vars[$var]) . ' ';
break;
default:
$dt_table .= htmlspecialchars($mysql_vars[$var]) . ' ';
}
$dt_table .= '</td>' . "\n" . '</tr>' . "\n";
$odd_row = !$odd_row;
$has_content = true;
}
if (!$has_content) {
return '';
}
$dt_table .= '</table>' . "\n";
return $dt_table;
}
示例5: resolveTypeSize
/**
* returns the pbxt engine specific handling for
* PMA_ENGINE_DETAILS_TYPE_SIZE variables.
*
* @param string $formatted_size the size expression (for example 8MB)
*
* @return string the formatted value and its unit
*/
function resolveTypeSize($formatted_size)
{
if (preg_match('/^[0-9]+[a-zA-Z]+$/', $formatted_size)) {
$value = PMA_extractValueFromFormattedSize($formatted_size);
} else {
$value = $formatted_size;
}
return PMA_formatByteDown($value);
}
示例6: getPageBufferpool
/**
* returns html tables with stats over inno db buffer pool
*
* @uses PMA_DBI_fetch_result()
* @uses PMA_formatNumber()
* @uses PMA_formatByteDown()
* @uses join()
* @uses htmlspecialchars()
* @uses PMA_formatNumber()
* @return string html table with stats
*/
function getPageBufferpool()
{
// The following query is only possible because we know
// that we are on MySQL 5 here (checked above)!
// side note: I love MySQL 5 for this. :-)
$sql = '
SHOW STATUS
WHERE Variable_name LIKE \'Innodb\\_buffer\\_pool\\_%\'
OR Variable_name = \'Innodb_page_size\';';
$status = PMA_DBI_fetch_result($sql, 0, 1);
$output = '<table class="data" id="table_innodb_bufferpool_usage">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . __('Buffer Pool Usage') . "\n" . ' </caption>' . "\n" . ' <tfoot>' . "\n" . ' <tr>' . "\n" . ' <th colspan="2">' . "\n" . ' ' . __('Total') . "\n" . ' : ' . PMA_formatNumber($status['Innodb_buffer_pool_pages_total'], 0) . ' ' . __('pages') . ' / ' . join(' ', PMA_formatByteDown($status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size'])) . "\n" . ' </th>' . "\n" . ' </tr>' . "\n" . ' </tfoot>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Free pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_free'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Dirty pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_dirty'], 0) . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Pages containing data') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_data'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Pages to be flushed') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_flushed'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Busy pages') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_misc'], 0) . "\n" . '</td>' . "\n" . ' </tr>';
// not present at least since MySQL 5.1.40
if (isset($status['Innodb_buffer_pool_pages_latched'])) {
$output .= ' <tr class="even">' . ' <th>' . __('Latched pages') . '</th>' . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_pages_latched'], 0) . '</td>' . ' </tr>';
}
$output .= ' </tbody>' . "\n" . '</table>' . "\n\n" . '<table class="data" id="table_innodb_bufferpool_activity">' . "\n" . ' <caption class="tblHeaders">' . "\n" . ' ' . __('Buffer Pool Activity') . "\n" . ' </caption>' . "\n" . ' <tbody>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read requests') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_read_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write requests') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_write_requests'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_reads'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits') . '</th>' . "\n" . ' <td class="value">' . PMA_formatNumber($status['Innodb_buffer_pool_wait_free'], 0) . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="odd">' . "\n" . ' <th>' . __('Read misses in %') . '</th>' . "\n" . ' <td class="value">' . ($status['Innodb_buffer_pool_read_requests'] == 0 ? '---' : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_reads'] * 100 / $status['Innodb_buffer_pool_read_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' <tr class="even">' . "\n" . ' <th>' . __('Write waits in %') . '</th>' . "\n" . ' <td class="value">' . ($status['Innodb_buffer_pool_write_requests'] == 0 ? '---' : htmlspecialchars(PMA_formatNumber($status['Innodb_buffer_pool_wait_free'] * 100 / $status['Innodb_buffer_pool_write_requests'], 3, 2)) . ' %') . "\n" . '</td>' . "\n" . ' </tr>' . "\n" . ' </tbody>' . "\n" . '</table>' . "\n";
return $output;
}
示例7: foreach
foreach ($binary_logs as $each_log) {
echo '<option value="' . $each_log['Log_name'] . '"';
if ($each_log['Log_name'] == $_REQUEST['log']) {
echo ' selected="selected"';
}
echo '>' . $each_log['Log_name'];
if (isset($each_log['File_size'])) {
$full_size += $each_log['File_size'];
echo ' (' . implode(' ', PMA_formatByteDown($each_log['File_size'], 3, 2)) . ')';
}
echo '</option>';
}
echo '</select> ';
echo count($binary_logs) . ' ' . __('Files') . ', ';
if ($full_size > 0) {
echo implode(' ', PMA_formatByteDown($full_size));
}
echo '</fieldset>';
echo '<fieldset class="tblFooters">';
echo '<input type="submit" value="' . __('Go') . '" />';
echo '</fieldset>';
echo '</form>';
}
PMA_showMessage(PMA_Message::success());
/**
* Displays the page
*/
?>
<table border="0" cellpadding="2" cellspacing="1">
<thead>
<tr>
示例8: PMA_handle_non_printable_contents
/**
* Verifies what to do with non-printable contents (binary or BLOB)
* in Browse mode.
*
* @uses is_null()
* @uses isset()
* @uses strlen()
* @uses PMA_formatByteDown()
* @uses strpos()
* @uses str_replace()
* @param string $category BLOB|BINARY|GEOMETRY
* @param string $content the binary content
* @param string $transform_function
* @param string $transform_options
* @param string $default_function
* @param object $meta the meta-information about this field
* @return mixed string or float
*/
function PMA_handle_non_printable_contents($category, $content, $transform_function, $transform_options, $default_function, $meta, $url_params = array())
{
$result = '[' . $category;
if (is_null($content)) {
$result .= ' - NULL';
$size = 0;
} elseif (isset($content)) {
$size = strlen($content);
$display_size = PMA_formatByteDown($size, 3, 1);
$result .= ' - ' . $display_size[0] . $display_size[1];
}
$result .= ']';
if (strpos($transform_function, 'octetstream')) {
$result = $content;
}
if ($size > 0) {
if ($default_function != $transform_function) {
$result = $transform_function($result, $transform_options, $meta);
} else {
$result = $default_function($result, array(), $meta);
if (stristr($meta->type, 'BLOB') && $_SESSION['tmp_user_values']['display_blob']) {
// in this case, restart from the original $content
$result = htmlspecialchars(PMA_replace_binary_contents($content));
}
/* Create link to download */
if (count($url_params) > 0) {
$result = '<a href="tbl_get_field.php' . PMA_generate_common_url($url_params) . '">' . $result . '</a>';
}
}
}
return $result;
}
示例9: list
$max_digits = 5;
$decimals = 1;
list($data_size, $data_unit) = PMA_formatByteDown($showtable['Data_length'], $max_digits, $decimals);
if ($mergetable == false) {
list($index_size, $index_unit) = PMA_formatByteDown($showtable['Index_length'], $max_digits, $decimals);
}
// InnoDB returns a huge value in Data_free, do not use it
if (!$is_innodb && isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
list($free_size, $free_unit) = PMA_formatByteDown($showtable['Data_free'], $max_digits, $decimals);
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'] - $showtable['Data_free'], $max_digits, $decimals);
} else {
list($effect_size, $effect_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
}
list($tot_size, $tot_unit) = PMA_formatByteDown($showtable['Data_length'] + $showtable['Index_length'], $max_digits, $decimals);
if ($table_info_num_rows > 0) {
list($avg_size, $avg_unit) = PMA_formatByteDown(($showtable['Data_length'] + $showtable['Index_length']) / $showtable['Rows'], 6, 1);
}
// Displays them
$odd_row = false;
?>
<a name="showusage"></a>
<?php
if (!$tbl_is_view && !$db_is_information_schema) {
?>
<table id="tablespaceusage" class="data">
<caption class="tblHeaders"><?php
echo $strSpaceUsage;
?>
</caption>
<thead>
示例10: getHtmlVariables
/**
* returns as HTML table of the engine's server variables
*
* @uses PMA_ENGINE_DETAILS_TYPE_SIZE
* @uses PMA_ENGINE_DETAILS_TYPE_NUMERIC
* @uses PMA_StorageEngine::getVariablesStatus()
* @uses $GLOBALS['strNoDetailsForEngine']
* @uses PMA_showHint()
* @uses PMA_formatByteDown()
* @uses PMA_formatNumber()
* @uses htmlspecialchars()
* @return string The table that was generated based on the retrieved information
*/
function getHtmlVariables()
{
$odd_row = false;
$ret = '';
foreach ($this->getVariablesStatus() as $details) {
$ret .= '<tr class="' . ($odd_row ? 'odd' : 'even') . '">' . "\n" . ' <td>' . "\n";
if (!empty($details['desc'])) {
$ret .= ' ' . PMA_showHint($details['desc']) . "\n";
}
$ret .= ' </td>' . "\n" . ' <th>' . htmlspecialchars($details['title']) . '</th>' . "\n" . ' <td class="value">';
switch ($details['type']) {
case PMA_ENGINE_DETAILS_TYPE_SIZE:
$parsed_size = PMA_formatByteDown($details['value']);
$ret .= $parsed_size[0] . ' ' . $parsed_size[1];
unset($parsed_size);
break;
case PMA_ENGINE_DETAILS_TYPE_NUMERIC:
$ret .= PMA_formatNumber($details['value']) . ' ';
break;
default:
$ret .= htmlspecialchars($details['value']) . ' ';
}
$ret .= '</td>' . "\n" . '</tr>' . "\n";
$odd_row = !$odd_row;
}
if (!$ret) {
$ret = '<p>' . "\n" . ' ' . $GLOBALS['strNoDetailsForEngine'] . "\n" . '</p>' . "\n";
} else {
$ret = '<table class="data">' . "\n" . $ret . '</table>' . "\n";
}
return $ret;
}
示例11: testFormatByteDown
/**
* format byte test, globals are defined
* @dataProvider formatByteDownDataProvider
*/
public function testFormatByteDown($a, $b, $c, $e)
{
$result = PMA_formatByteDown($a, $b, $c);
$result[0] = trim($result[0]);
$this->assertEquals($e, $result);
}
示例12: __
<?php
echo __('in use');
?>
</td>
<?php
}
// end if (isset($each_table['TABLE_ROWS'])) else
?>
</tr>
<?php
}
// end foreach
// Show Summary
if ($is_show_stats) {
list($sum_formatted, $unit) = PMA_formatByteDown($sum_size, 3, 1);
list($overhead_formatted, $overhead_unit) = PMA_formatByteDown($overhead_size, 3, 1);
}
?>
</tbody>
<tbody id="tbl_summary_row">
<tr><th></th>
<th align="center" nowrap="nowrap">
<?php
// for blobstreaming - if the number of tables is 0, set tableReductionCount to 0
// (we don't want negative numbers here)
if ($num_tables == 0) {
$tableReductionCount = 0;
}
echo sprintf(_ngettext('%s table', '%s tables', $num_tables - $tableReductionCount), PMA_formatNumber($num_tables - $tableReductionCount, 0));
?>
</th>
示例13: PMA_displayMaximumUploadSize
/**
* Displays the maximum size for an upload
*
* @param integer $max_upload_size the size
*
* @return string the message
*
* @access public
*/
function PMA_displayMaximumUploadSize($max_upload_size)
{
// I have to reduce the second parameter (sensitiveness) from 6 to 4
// to avoid weird results like 512 kKib
list($max_size, $max_unit) = PMA_formatByteDown($max_upload_size, 4);
return '(' . sprintf(__('Max: %s%s'), $max_size, $max_unit) . ')';
}
示例14: implode
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_sent'] * $hour_factor, 4));
?>
</td>
</tr>
<tr class="odd">
<th class="name"><?php
echo $strTotalUC;
?>
</th>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown($server_status['Bytes_received'] + $server_status['Bytes_sent'], 4));
?>
</td>
<td class="value"><?php
echo implode(' ', PMA_formatByteDown(($server_status['Bytes_received'] + $server_status['Bytes_sent']) * $hour_factor, 4));
?>
</td>
</tr>
</tbody>
</table>
<table id="serverstatusconnections" class="data">
<thead>
<tr>
<th colspan="2"><?php
echo $strConnections;
?>
</th>
<th>ø <?php
echo $strPerHour;
示例15: PMA_displayMaximumUploadSize
/**
* Displays the maximum size for an upload
*
* @param integer the size
*
* @return string the message
*
* @access public
*/
function PMA_displayMaximumUploadSize($max_upload_size)
{
list($max_size, $max_unit) = PMA_formatByteDown($max_upload_size);
return '(' . sprintf($GLOBALS['strMaximumSize'], $max_size, $max_unit) . ')';
}