当前位置: 首页>>代码示例>>PHP>>正文


PHP Files::bytesToSizeString方法代码示例

本文整理汇总了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);
 }
开发者ID:simonschaufi,项目名称:M12.DbExport,代码行数:32,代码来源:DbCommandController.php

示例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']);
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:23,代码来源:BytesViewHelper.php

示例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);
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:14,代码来源:FilesTest.php

示例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)));
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:9,代码来源:AssetController.php

示例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)));
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:10,代码来源:AssetController.php


注:本文中的TYPO3\Flow\Utility\Files::bytesToSizeString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。