本文整理汇总了PHP中XLite\Core\Converter::convertShortSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::convertShortSize方法的具体用法?PHP Converter::convertShortSize怎么用?PHP Converter::convertShortSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\Core\Converter
的用法示例。
在下文中一共展示了Converter::convertShortSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doNoAction
/**
* Preprocessor for no-action
*
* @return void
*/
protected function doNoAction()
{
$this->startTime = time();
$this->startMemory = memory_get_usage(true);
$this->memoryLimitIni = \XLite\Core\Converter::convertShortSize(ini_get('memory_limit') ?: '16M');
foreach (\XLite\Core\Database::getRepo('XLite\\Model\\Task')->getCurrentQuery() as $task) {
$task = $task[0];
$runner = $task->getOwnerInstance();
if ($runner) {
$this->runRunner($runner);
}
sleep($this->sleepTime);
if (!$this->checkThreadResource()) {
$time = gmdate('H:i:s', time() - $this->startTime);
$memory = \XLite\Core\Converter::formatFileSize(memory_get_usage(true));
$this->printContent('Step is interrupted (time: ' . $time . '; memory usage: ' . $memory . ')');
break;
}
}
}
示例2: doNoAction
protected function doNoAction()
{
$request = \XLite\Core\Request::getInstance();
$server = $request->getServerData();
$size = \XLite\Core\Converter::convertShortSize(ini_get('post_max_size'));
if (isset($server['CONTENT_LENGTH']) && $server['CONTENT_LENGTH'] > $size) {
\XLite\Core\TopMessage::addError('File size exceeds the maximum size', array('size' => \XLite\Core\Converter::convertShortSizeToHumanReadable($size)));
$this->setReturnURL($this->getReferrerURL());
}
}