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


PHP KTUtil::filesizeToString方法代码示例

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


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

示例1: loadDocumentInfo

 public function loadDocumentInfo()
 {
     global $default;
     $sql = "SELECT\n\t\t\t\t\td.folder_id, f.full_path, f.name, dcv.size as filesize, dcv.major_version,\n\t\t\t\t\tdcv.minor_version, dcv.filename, cou.name as checkoutuser, w.human_name as workflow, ws.human_name as workflowstate,\n\t\t\t\t\tmt.mimetypes as mimetype, md.mime_doc as mimedoc, d.checkedout, mbu.name as modifiedbyuser, d.modified,\n\t\t\t\t\tcbu.name as createdbyuser, ou.name as owneruser, d.immutable, d.status_id, d.created,dcv.storage_path, dtl.name as document_type,\n\t\t\t\t\tmt.icon_path as mime_icon_path, mt.friendly_name as mime_display, d.oem_no, dmv.name as title\n\t\t\t\tFROM\n\t\t\t\t\tdocuments d\n\t\t\t\t\tINNER JOIN document_metadata_version dmv ON d.metadata_version_id = dmv.id\n\t\t\t\t\tINNER JOIN document_content_version dcv ON dmv.content_version_id = dcv.id\n\t\t\t\t\tINNER JOIN mime_types mt ON dcv.mime_id=mt.id\n\t\t\t\t\tLEFT JOIN document_types_lookup dtl ON dtl.id=dmv.document_type_id\n\t\t\t\t\tLEFT JOIN folders f ON f.id=d.folder_id\n\t\t\t\t\tLEFT JOIN users cou ON d.checked_out_user_id=cou.id\n\t\t\t\t\tLEFT JOIN workflows w ON dmv.workflow_id=w.id\n\t\t\t\t\tLEFT JOIN workflow_states ws ON dmv.workflow_state_id = ws.id\n\t\t\t\t\tLEFT JOIN mime_documents md ON mt.mime_document_id = md.id\n\t\t\t\t\tLEFT JOIN users mbu ON d.modified_user_id=mbu.id\n\t\t\t\t\tLEFT JOIN users cbu ON d.creator_id=cbu.id\n\t\t\t\t\tLEFT JOIN users ou ON d.owner_id=ou.id\n\t\t\t\tWHERE\n\t\t\t\t\td.id={$this->id}";
     if ($this->inclStatus) {
         $sql .= " AND d.status_id = 1";
     }
     $result = DBUtil::getOneResult($sql);
     if (PEAR::isError($result) || empty($result)) {
         $this->live = false;
         if (PEAR::isError($result)) {
             throw new Exception('Database exception! There appears to be an error in the system: ' . $result->getMessage());
         }
         $default->log->error('QueryResultItem: $result is null');
         $msg = 'The database did not have a record matching the result from the document indexer. This may occur if there is an inconsistency between the document indexer and the repository. The indexer needs to be repaired.';
         $default->log->error('QueryResultItem: ' . $msg);
         // TODO: repair process where we scan documents in index, and delete those for which there is nothing in the repository
         throw new IndexerInconsistencyException(sprintf(_kt('%s'), $msg));
     }
     // document_id, relevance, text, title
     $this->documentType = $result['document_type'];
     $this->filename = $result['filename'];
     $this->filesize = KTUtil::filesizeToString($result['filesize']);
     $this->folderId = $result['folder_id'];
     $this->title = $result['title'];
     $this->createdBy = $result['createdbyuser'];
     $this->dateCreated = $result['created'];
     $this->modifiedBy = $result['modifiedbyuser'];
     $this->dateModified = $result['modified'];
     $this->checkedOutUser = $result['checkoutuser'];
     $this->dateCheckedout = $result['checkedout'];
     $this->owner = $result['owneruser'];
     $this->version = $result['major_version'] . '.' . $result['minor_version'];
     $this->immutable = $result['immutable'] + 0 ? _kt('Immutable') : '';
     $this->workflow = $result['workflow'];
     $this->workflowState = $result['workflowstate'];
     $this->oemDocumentNo = $result['oem_no'];
     if (empty($this->oemDocumentNo)) {
         $this->oemDocumentNo = 'n/a';
     }
     if (is_null($result['name'])) {
         $this->fullpath = '(orphaned)';
     } else {
         $this->fullpath = $result['full_path'];
     }
     $this->mimeType = $result['mimetype'];
     $this->mimeIconPath = $result['mime_icon_path'];
     if (empty($this->mimeIconPath)) {
         $this->mimeIconPath = 'unspecified_type';
     }
     $this->mimeDisplay = $result['mime_display'];
     $this->storagePath = $result['storage_path'];
     $this->status = Document::getStatusString($result['status_id']);
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:54,代码来源:indexerCore.inc.php

示例2: getKTUsageStats

 public static function getKTUsageStats($update = true)
 {
     $usage = array();
     $oRegistry =& KTPluginRegistry::getSingleton();
     $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
     $folders = self::getDirectories();
     foreach ($folders as $folder) {
         $directory = $folder['folder'];
         $pattern = $folder['pattern'];
         $canClean = $folder['canClean'];
         $name = $folder['name'];
         $temp = self::scanPath($directory, $pattern);
         $usage[] = array('description' => $name, 'folder' => $directory, 'files' => number_format($temp['files'], 0, '.', ','), 'filesize' => KTUtil::filesizeToString($temp['filesize']), 'action' => $i, 'canClean' => $canClean);
     }
     if ($update) {
         KTUtil::setSystemSetting('KTUsage', serialize($usage));
     }
     return $usage;
 }
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:19,代码来源:HouseKeeper.inc.php


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