當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。