/** * @todo Implement testFileSize(). */ public function testFileSize() { $this->assertEquals('0 B', Formatter::fileSize(0)); $this->assertEquals('1.00 KiB', Formatter::fileSize(1000)); $this->assertEquals('1.02 KiB', Formatter::fileSize(1024)); // Test fails due to floating point precision? //$this->assertEquals('1.03 KiB', Formatter::fileSize(1025)); $this->assertEquals('1.03 KiB', Formatter::fileSize(1025.1)); $this->assertEquals('1.00 MiB', Formatter::fileSize(1000000)); $this->assertEquals('1.00 GiB', Formatter::fileSize(1000000000)); $this->assertEquals('1.00 TiB', Formatter::fileSize(1000000000000)); $this->assertEquals('1.00 PiB', Formatter::fileSize(1000000000000000)); }
/** * Returns the maximum filesize to upload * * @param bool return as formatted string * @return mixed */ public static function getMaxUploadSize($_asString = false, $_value = null) { $maxUpload = ConfigUtil::ini2bytes(ini_get("upload_max_filesize")); $maxPost = ConfigUtil::ini2bytes(ini_get("post_max_size")); if ($_value != null) { if ($_value < $maxUpload) { $maxUpload = $_value; } if ($_value < $maxPost) { $maxPost = $_value; } } if ($maxPost < $maxUpload) { $maxUpload = $maxPost; } if ($_asString) { return Formatter::fileSize($maxUpload); } else { return $maxUpload; } }
<th colspan="8"><?php echo Yii::t('core', 'amountTables', array($tableCount, '{amount} ' => $tableCount)); ?> </th> <th><?php echo $totalRowCount; ?> </th> <th></th> <th></th> <th style="text-align: right"><?php echo Formatter::fileSize($totalDataLength); ?> </th> <th style="text-align: right"><?php echo Formatter::fileSize($totalDataFree); ?> </th> </tr> </tfoot> </table> <div class="buttonContainer"> <div class="left withSelected"> <span class="icon"> <?php echo Html::icon('arrow_turn_090'); ?> <span><?php echo Yii::t('core', 'withSelected'); ?>
echo $model->schema; ?> '})"> <?php echo Html::icon('save'); ?> <?php echo Formatter::fileSize(strlen($value)); ?> </a> <?php } else { ?> <?php echo Formatter::fileSize(strlen($value)); ?> <?php } ?> <?php } elseif ($model->table !== null) { ?> <span><?php echo is_null($value) ? '<span class="null">NULL</span>' : (Yii::app()->user->settings->get('showFullColumnContent', 'schema.table.browse', $model->schema . '.' . $model->table) ? htmlspecialchars($value) : StringUtil::cutText(htmlspecialchars($value), 100)); ?> </span> <?php } else { ?> <span><?php
<td><?php echo Yii::t('core', 'averageRowLength'); ?> </td> <td><?php echo $table->AVG_ROW_LENGTH; ?> </td> </tr> <tr> <td><?php echo Yii::t('core', 'averageRowSize'); ?> </td> <td><?php echo Formatter::fileSize($table->getAverageRowSize()); ?> </td> </tr> <?php if ($table->AUTO_INCREMENT) { ?> <tr> <td><?php echo Yii::t('core', 'nextAutoincrementValue'); ?> </td> <td><?php echo $table->AUTO_INCREMENT; ?> </td>