本文整理汇总了PHP中KTUtil::computePeriod方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::computePeriod方法的具体用法?PHP KTUtil::computePeriod怎么用?PHP KTUtil::computePeriod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KTUtil
的用法示例。
在下文中一共展示了KTUtil::computePeriod方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render()
{
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_migration');
$config = KTConfig::getSingleton();
$batchDocuments = $config->get('indexer/batchMigrateDocuments');
$migratedDocuments = KTUtil::getSystemSetting('migratedDocuments', 0);
$migratingDocuments = $this->migratingDocuments;
$migrationStart = KTUtil::getSystemSetting('migrationStarted');
if (is_null($migrationStart)) {
$migrationStartString = _kt('Not started');
$migrationPeriod = _kt('N/A');
$estimatedTime = _kt('Unknown');
$estimatedPeriod = $estimatedTime;
} else {
$migrationStartString = date('Y-m-d H:i:s', $migrationStart);
$migrationTime = KTUtil::getSystemSetting('migrationTime', 0);
$migrationPeriod = KTUtil::computePeriod($migrationTime, '');
// Cannot divide by zero so make it 1
$divMigratedDocuments = $migratedDocuments > 0 ? $migratedDocuments : 1;
$timePerDocument = $migrationTime / $divMigratedDocuments;
$estimatedPeriod = $timePerDocument * $migratingDocuments;
$estimatedTime = date('Y-m-d H:i:s', $migrationStart + $estimatedPeriod);
$estimatedPeriod = KTUtil::computePeriod($estimatedPeriod, '');
}
$aTemplateData = array('context' => $this, 'batchDocuments' => $batchDocuments, 'batchPeriod' => 'Periodically', 'migrationStart' => $migrationStartString, 'migrationPeriod' => $migrationPeriod, 'migratedDocuments' => $migratedDocuments, 'migratingDocuments' => $migratingDocuments, 'estimatedTime' => $estimatedTime, 'estimatedPeriod' => $estimatedPeriod);
return $oTemplate->render($aTemplateData);
}