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


PHP KTUtil::computePeriodToDate方法代码示例

本文整理汇总了PHP中KTUtil::computePeriodToDate方法的典型用法代码示例。如果您正苦于以下问题:PHP KTUtil::computePeriodToDate方法的具体用法?PHP KTUtil::computePeriodToDate怎么用?PHP KTUtil::computePeriodToDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KTUtil的用法示例。


在下文中一共展示了KTUtil::computePeriodToDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getIndexStatistics

 public function getIndexStatistics()
 {
     $optimisationDate = KTUtil::getSystemSetting('luceneOptimisationDate', '');
     $noOptimisation = false;
     if ($optimisationDate == '') {
         $optimisationDate = _kt('N/A');
         $optimisationPeriod = $optimisationDate;
     } else {
         $optimisationPeriod = KTUtil::computePeriodToDate($optimisationDate, null, true);
         $noOptimisation = $optimisationPeriod['days'] > 2;
         $optimisationPeriod = $optimisationPeriod['str'];
         $optimisationDate = date('Y-m-d H:i:s', $optimisationDate);
     }
     $indexingDate = KTUtil::getSystemSetting('luceneIndexingDate', '');
     if ($indexingDate == '') {
         $indexingDate = _kt('N/A');
         $indexingPeriod = $indexingDate;
     } else {
         $indexingPeriod = KTUtil::computePeriodToDate($indexingDate);
         $indexingDate = date('Y-m-d H:i:s', $indexingDate);
     }
     $index = Indexer::get();
     $docsInIndex = $index->getDocumentsInIndex();
     // we are only interested in documents that are active
     $sql = "SELECT count(*) as docsInQueue FROM index_files i inner join documents d on i.document_id = d.id where (i.status_msg is null or i.status_msg = '') and d.status_id=1";
     $docsInQueue = DBUtil::getOneResultKey($sql, 'docsInQueue');
     $sql = "SELECT count(*) as errorsInQueue FROM index_files i inner join documents d on i.document_id = d.id  where (i.status_msg is not null or i.status_msg <> '') and d.status_id=1";
     $errorsInQueue = DBUtil::getOneResultKey($sql, 'errorsInQueue');
     $sql = "SELECT count(*) as docsInRepository FROM documents where status_id=1";
     $docsInRepository = DBUtil::getOneResultKey($sql, 'docsInRepository');
     if ($docsInRepository == 0) {
         $indexingCoverage = '0.00%';
         $queueCoverage = $indexingCoverage;
     } else {
         // compute indexing coverage
         $indexingCoverage = _kt('Not Available');
         if (is_numeric($docsInIndex)) {
             $indexingCoverage = $docsInIndex * 100 / $docsInRepository;
             $indexingCoverage = number_format($indexingCoverage, 2, '.', ',') . '%';
         }
         // compute queue coverage
         $queueCoverage = _kt('Not Available');
         if (is_numeric($docsInQueue)) {
             $queueCoverage = $docsInQueue * 100 / $docsInRepository;
             $queueCoverage = number_format($queueCoverage, 2, '.', ',') . '%';
         }
     }
     $stats = array('optimisationDate' => $optimisationDate, 'optimisationPeriod' => $optimisationPeriod, 'indexingDate' => $indexingDate, 'indexingPeriod' => $indexingPeriod, 'docsInIndex' => $docsInIndex, 'docsInQueue' => $docsInQueue, 'errorsInQueue' => $errorsInQueue, 'docsInRepository' => $docsInRepository, 'indexingCoverage' => $indexingCoverage, 'queueCoverage' => $queueCoverage, 'noOptimisation' => $noOptimisation);
     return $stats;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:50,代码来源:indexerCore.inc.php


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