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


PHP ResourceStorage::hasFile方法代码示例

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


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

示例1: processChangedAndNewFiles

 /**
  * Processes the Files which have been detected as "changed or new"
  * in the storage
  *
  * @return void
  */
 protected function processChangedAndNewFiles()
 {
     foreach ($this->filesToUpdate as $identifier => $data) {
         if ($data == NULL) {
             // search for files with same content hash in indexed storage
             $fileHash = $this->storage->hashFileByIdentifier($identifier, 'sha1');
             $files = $this->getFileIndexRepository()->findByContentHash($fileHash);
             $fileObject = NULL;
             if (!empty($files)) {
                 foreach ($files as $fileIndexEntry) {
                     // check if file is missing then we assume it's moved/renamed
                     if (!$this->storage->hasFile($fileIndexEntry['identifier'])) {
                         $fileObject = $this->getResourceFactory()->getFileObject($fileIndexEntry['uid'], $fileIndexEntry);
                         $fileObject->updateProperties(array('identifier' => $identifier));
                         $this->updateIndexEntry($fileObject);
                         $this->identifiedFileUids[] = $fileObject->getUid();
                         break;
                     }
                 }
             }
             // create new index when no missing file with same content hash is found
             if ($fileObject === NULL) {
                 $fileObject = $this->createIndexEntry($identifier);
                 $this->identifiedFileUids[] = $fileObject->getUid();
             }
         } else {
             // update existing file
             $fileObject = $this->getResourceFactory()->getFileObject($data['uid'], $data);
             $this->updateIndexEntry($fileObject);
         }
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:38,代码来源:Indexer.php

示例2: exists

 /**
  * Checks if this file exists. This should normally always return TRUE;
  * it might only return FALSE when this object has been created from an
  * index record without checking for.
  *
  * @return boolean TRUE if this file physically exists
  */
 public function exists()
 {
     if ($this->deleted) {
         return FALSE;
     }
     return $this->storage->hasFile($this->getIdentifier());
 }
开发者ID:rob-ot-dot-be,项目名称:ggallkeysecurity,代码行数:14,代码来源:AbstractFile.php

示例3: detectMissingFiles

 /**
  * Since by now all files in filesystem have been looked at it is save to assume,
  * that files that are in indexed but not touched in this run are missing
  */
 protected function detectMissingFiles()
 {
     $indexedNotExistentFiles = $this->getFileIndexRepository()->findInStorageAndNotInUidList($this->storage, $this->identifiedFileUids);
     foreach ($indexedNotExistentFiles as $record) {
         if (!$this->storage->hasFile($record['identifier'])) {
             $this->getFileIndexRepository()->markFileAsMissing($record['uid']);
         }
     }
 }
开发者ID:allipierre,项目名称:Typo3,代码行数:13,代码来源:Indexer.php

示例4: findByStorageAndIdentifier

 /**
  * @param ResourceStorage $storage
  * @param string $identifier
  *
  * @return null|ProcessedFile
  */
 public function findByStorageAndIdentifier(ResourceStorage $storage, $identifier)
 {
     $processedFileObject = null;
     if ($storage->hasFile($identifier)) {
         $databaseRow = $this->databaseConnection->exec_SELECTgetSingleRow('*', $this->table, 'storage = ' . (int) $storage->getUid() . ' AND identifier = ' . $this->databaseConnection->fullQuoteStr($identifier, $this->table));
         if ($databaseRow) {
             $processedFileObject = $this->createDomainObject($databaseRow);
         }
     }
     return $processedFileObject;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:17,代码来源:ProcessedFileRepository.php

示例5: findByStorageAndIdentifier

 /**
  * @param ResourceStorage $storage
  * @param string $identifier
  *
  * @return null|ProcessedFile
  */
 public function findByStorageAndIdentifier(ResourceStorage $storage, $identifier)
 {
     $processedFileObject = null;
     if ($storage->hasFile($identifier)) {
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->table);
         $databaseRow = $queryBuilder->select('*')->from($this->table)->where($queryBuilder->expr()->eq('storage', $queryBuilder->createNamedParameter($storage->getUid(), \PDO::PARAM_INT)), $queryBuilder->expr()->eq('identifier', $queryBuilder->createNamedParameter($identifier, \PDO::PARAM_STR)))->execute()->fetch();
         if ($databaseRow) {
             $processedFileObject = $this->createDomainObject($databaseRow);
         }
     }
     return $processedFileObject;
 }
开发者ID:,项目名称:,代码行数:18,代码来源:


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