本文整理汇总了PHP中TYPO3\Flow\Utility\Files::bytesToSizeString方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::bytesToSizeString方法的具体用法?PHP Files::bytesToSizeString怎么用?PHP Files::bytesToSizeString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Utility\Files
的用法示例。
在下文中一共展示了Files::bytesToSizeString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exportCommand
/**
* Export the database
*
* @param string $packageKey Package key where the .sql file will be exported (into [PACKAGE_KEY]/Resources/Private/Content/ directory)
* @param string $sqlFile Relative path to .sql file
* @param string $mode Choose 'content' (default) for content only tables or 'all' for whole database dump.
*/
public function exportCommand($packageKey = NULL, $sqlFile = NULL, $mode = self::DUMP_MODE_CONTENT_ONLY)
{
$dbName = $this->backendOptions['dbname'];
$tablesToExport = $this->getTablesToExport($mode);
if ($packageKey) {
$sqlFile = $this->getContentDirectoryForPackageKey($packageKey, TRUE) . $this->getFilenameForDump($mode);
$sqlFile = str_replace(FLOW_PATH_ROOT, '', $sqlFile);
} elseif ($sqlFile) {
} else {
$this->outputLine('You have to specify either "--package-key" or "--sql-file"');
$this->quit(1);
}
$cmd = 'mysqldump -v' . $this->getSqlConnectionParams() . " {$dbName} {$tablesToExport} > {$sqlFile}";
$result = $this->exec($cmd);
$size = filesize($sqlFile);
// Note: make it compatible with Flow 2.2 where Files::bytesToSizeString() is not available
$sizeFormatted = method_exists('TYPO3\\Flow\\Utility\\Files', 'bytesToSizeString') ? Files::bytesToSizeString($size) : round($size / 1024) . ' kB';
$this->outputLine();
$this->outputLine("Database '{$dbName}' has been exported to '{$sqlFile}' file.");
$this->outputLine("Exported {$sqlFile} file size: " . $sizeFormatted);
$this->outputLine();
$this->outputLine("Exported tables: " . ($tablesToExport ? $tablesToExport : '[all]') . '.');
$this->outputLine();
$this->sendAndExit($result);
}
示例2: renderStatic
/**
* Applies htmlspecialchars() on the specified value.
*
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param \TYPO3\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
* @return string
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
$value = $arguments['value'];
if ($value === null) {
$value = $renderChildrenClosure();
}
if (!is_integer($value) && !is_float($value)) {
if (is_numeric($value)) {
$value = (double) $value;
} else {
$value = 0;
}
}
return Files::bytesToSizeString($value, $arguments['decimals'], $arguments['decimalSeparator'], $arguments['thousandsSeparator']);
}
示例3: bytesToSizeStringTests
/**
* @param $bytes
* @param $decimals
* @param $decimalSeparator
* @param $thousandsSeparator
* @param $expected
* @test
* @dataProvider bytesToSizeStringDataProvider
*/
public function bytesToSizeStringTests($bytes, $decimals, $decimalSeparator, $thousandsSeparator, $expected)
{
$actualResult = Files::bytesToSizeString($bytes, $decimals, $decimalSeparator, $thousandsSeparator);
$this->assertSame($expected, $actualResult);
}
示例4: replaceAssetResourceAction
/**
* @param Asset $asset
* @return void
*/
public function replaceAssetResourceAction(Asset $asset)
{
$maximumFileUploadSize = $this->maximumFileUploadSize();
$this->view->assignMultiple(array('asset' => $asset, 'maximumFileUploadSize' => $maximumFileUploadSize, 'redirectPackageEnabled' => $this->packageManager->isPackageAvailable('Neos.RedirectHandler'), 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize)));
}
示例5: renderMaximumFileUploadSize
/**
* Returns the lowest configured maximum upload file size
*
* @return string
*/
protected function renderMaximumFileUploadSize()
{
$maximumFileUploadSizeInBytes = min(Files::sizeStringToBytes(ini_get('post_max_size')), Files::sizeStringToBytes(ini_get('upload_max_filesize')));
return sprintf('"%d"; // %s, as configured in php.ini', $maximumFileUploadSizeInBytes, Files::bytesToSizeString($maximumFileUploadSizeInBytes));
}
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:10,代码来源:JavascriptConfigurationViewHelper.php
示例6: newAction
/**
* New asset form
*
* @return void
*/
public function newAction()
{
$maximumFileUploadSize = $this->maximumFileUploadSize();
$this->view->assignMultiple(array('tags' => $this->tagRepository->findAll(), 'assetCollections' => $this->assetCollectionRepository->findAll(), 'maximumFileUploadSize' => $maximumFileUploadSize, 'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize)));
}