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


PHP Resource\ResourceStorage类代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     $this->storageMock = $this->getMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class, array(), array(), '', false);
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
     $mockedMetaDataRepository = $this->getMock(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
     $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, $mockedMetaDataRepository);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:9,代码来源:FileTest.php

示例2: setUp

 public function setUp()
 {
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     $this->storageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE);
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
     $mockedMetaDataRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository');
     $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', $mockedMetaDataRepository);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:9,代码来源:FileTest.php

示例3: 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

示例4: 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,代码来源:

示例5: addFileMountsToStorage

 /**
  * Adds file mounts from the user's file mount records
  *
  * @param ResourceStorage $storage
  * @return void
  */
 protected function addFileMountsToStorage(ResourceStorage $storage)
 {
     foreach ($this->backendUserAuthentication->getFileMountRecords() as $fileMountRow) {
         if ((int) $fileMountRow['base'] === (int) $storage->getUid()) {
             try {
                 $storage->addFileMount($fileMountRow['path'], $fileMountRow);
             } catch (FolderDoesNotExistException $e) {
                 // That file mount does not seem to be valid, fail silently
             }
         }
     }
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例6: searchForDuplicateSha1

 /**
  * Return duplicates file records
  *
  * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
  * @return array
  */
 public function searchForDuplicateSha1(ResourceStorage $storage)
 {
     // Detect duplicate records.
     $query = "SELECT sha1 FROM sys_file WHERE storage = {$storage->getUid()} GROUP BY sha1, storage Having COUNT(*) > 1";
     $resource = $this->getDatabaseConnection()->sql_query($query);
     $duplicates = array();
     while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) {
         $clause = sprintf('sha1 = "%s" AND storage = %s', $row['sha1'], $storage->getUid());
         $records = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_file', $clause);
         $duplicates[$row['sha1']] = $records;
     }
     return $duplicates;
 }
开发者ID:visol,项目名称:media,代码行数:19,代码来源:IndexAnalyser.php

示例7: setUp

 /**
  * Set up
  *
  * @return void
  */
 public function setUp()
 {
     $this->singletonInstances = \TYPO3\CMS\Core\Utility\GeneralUtility::getSingletonInstances();
     $this->fileCollectionMock = $this->getAccessibleMock('\\TYPO3\\CMS\\Core\\Resource\\Collection\\AbstractFileCollection', array('loadContents', 'getItems'), array(), '', FALSE);
     $this->fileCollectionMock->expects($this->atLeastOnce())->method('loadContents');
     $this->fileCollectionRepositoryMock = $this->getMock('\\TYPO3\\CMS\\Core\\Resource\\FileCollectionRepository', array('findByUid'), array(), '', FALSE);
     $this->fileCollectionRepositoryMock->expects($this->any())->method('findByUid')->will($this->returnValue($this->fileCollectionMock));
     $this->frontendConfigurationManagerMock = $this->getMock('\\TYPO3\\CMS\\Extbase\\Configuration\\FrontendConfigurationManager', array('getConfiguration'), array(), '', FALSE);
     $this->storageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', array(), array(), '', FALSE);
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue(5));
     $this->subject = GeneralUtility::makeInstance('SKYFILLERS\\SfFilecollectionGallery\\Service\\FileCollectionService');
     $this->subject->injectFileCollectionRepository($this->fileCollectionRepositoryMock);
     $this->subject->injectFrontendConfigurationManager($this->frontendConfigurationManagerMock);
 }
开发者ID:rabe69,项目名称:sf_filecollection_gallery,代码行数:19,代码来源:FileCollectionServiceTest.php

示例8: setUp

 public function setUp()
 {
     $this->singletonInstances = GeneralUtility::getSingletonInstances();
     // Disable xml2array cache used by ResourceFactory
     GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->setCacheConfigurations(array('cache_hash' => array('frontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend', 'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\TransientMemoryBackend')));
     $this->testDocumentsPath = ExtensionManagementUtility::extPath('tika') . 'Tests/TestDocuments/';
     $driver = $this->createDriverFixture(array('basePath' => $this->testDocumentsPath, 'caseSensitive' => TRUE));
     $storageRecord = array('uid' => $this->storageUid, 'is_public' => TRUE, 'is_writable' => FALSE, 'is_browsable' => TRUE, 'is_online' => TRUE, 'configuration' => $this->convertConfigurationArrayToFlexformXml(array('basePath' => $this->testDocumentsPath, 'pathType' => 'absolute', 'caseSensitive' => '1')));
     $this->storageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', NULL, array($driver, $storageRecord));
     $this->storageMock->expects($this->any())->method('getUid')->will($this->returnValue($this->storageUid));
     $mockedMetaDataRepository = $this->getMock('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository');
     $mockedMetaDataRepository->expects($this->any())->method('findByFile')->will($this->returnValue(array('file' => 1)));
     \TYPO3\CMS\Core\Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Resource\\Index\\MetaDataRepository', $mockedMetaDataRepository);
 }
开发者ID:AndreasA,项目名称:ext-tika,代码行数:14,代码来源:ServerServiceTest.php

示例9: setUpLanguagesStorageMock

 protected function setUpLanguagesStorageMock()
 {
     $this->testLanguagesPath = ExtensionManagementUtility::extPath('tika') . 'Tests/TestLanguages/';
     $languagesDriver = $this->createDriverFixture(array('basePath' => $this->testLanguagesPath, 'caseSensitive' => TRUE));
     $languagesStorageRecord = array('uid' => $this->languagesStorageUid, 'is_public' => TRUE, 'is_writable' => FALSE, 'is_browsable' => TRUE, 'is_online' => TRUE, 'configuration' => $this->convertConfigurationArrayToFlexformXml(array('basePath' => $this->testLanguagesPath, 'pathType' => 'absolute', 'caseSensitive' => '1')));
     $this->languagesStorageMock = $this->getMock('TYPO3\\CMS\\Core\\Resource\\ResourceStorage', NULL, array($languagesDriver, $languagesStorageRecord));
     $this->languagesStorageMock->expects($this->any())->method('getUid')->will($this->returnValue($this->languagesStorageUid));
 }
开发者ID:visol,项目名称:ext-tika,代码行数:8,代码来源:ServiceUnitTestCase.php

示例10: generatePublicUrl

 /**
  * Generate public url for file
  *
  * @param Resource\ResourceStorage $storage
  * @param Resource\Driver\DriverInterface $driver
  * @param Resource\FileInterface $file
  * @param $relativeToCurrentScript
  * @param array $urlData
  * @return void
  */
 public function generatePublicUrl(Resource\ResourceStorage $storage, Resource\Driver\DriverInterface $driver, Resource\FileInterface $file, $relativeToCurrentScript, array $urlData)
 {
     // We only render special links for non-public files
     if ($this->enabled && !$storage->isPublic()) {
         $queryParameterArray = array('eID' => 'dumpFile', 't' => '');
         if ($file instanceof Resource\File) {
             $queryParameterArray['f'] = $file->getUid();
             $queryParameterArray['t'] = 'f';
         } elseif ($file instanceof Resource\ProcessedFile) {
             $queryParameterArray['p'] = $file->getUid();
             $queryParameterArray['t'] = 'p';
         }
         $queryParameterArray['token'] = GeneralUtility::hmac(implode('|', $queryParameterArray), 'BeResourceStorageDumpFile');
         // $urlData['publicUrl'] is passed by reference, so we can change that here and the value will be taken into account
         $urlData['publicUrl'] = BackendUtility::getAjaxUrl('FalSecuredownload::publicUrl', $queryParameterArray);
     }
 }
开发者ID:camrun91,项目名称:fal_securedownload,代码行数:27,代码来源:PublicUrlAspect.php

示例11: folderListingsDoNotContainHiddenFoldersByDefault

 /**
  * Test if the default filters filter out hidden folders (like .htaccess)
  *
  * @test
  */
 public function folderListingsDoNotContainHiddenFoldersByDefault()
 {
     $this->addToMount(array('someFolder' => array(), '.someHiddenFolder' => array()));
     $this->prepareFixture();
     $this->fixture->resetFileAndFolderNameFiltersToDefault();
     $folderList = $this->fixture->getFolderList('/');
     $this->assertContains('someFolder', array_keys($folderList));
     $this->assertNotContains('.someHiddenFolder', array_keys($folderList));
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:14,代码来源:StorageTest.php

示例12: migrateRecord

    /**
     * Processes the actual transformation from CSV to sys_file_references
     *
     * @param array $record
     * @return void
     */
    protected function migrateRecord(array $record)
    {
        $collections = array();
        if (trim($record['select_key'])) {
            $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_collection', array('pid' => $record['pid'], 'title' => $record['select_key'], 'storage' => $this->storage->getUid(), 'folder' => ltrim('fileadmin/', $record['select_key'])));
            $collections[] = $GLOBALS['TYPO3_DB']->sql_insert_id();
        }
        $files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $record['media'], TRUE);
        $descriptions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagecaption']);
        $titleText = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['titleText']);
        $i = 0;
        foreach ($files as $file) {
            if (file_exists(PATH_site . 'uploads/media/' . $file)) {
                \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move(PATH_site . 'uploads/media/' . $file, $this->targetDirectory . $file);
                $fileObject = $this->storage->getFile(self::FOLDER_ContentUploads . '/' . $file);
                $this->fileRepository->addToIndex($fileObject);
                $dataArray = array('uid_local' => $fileObject->getUid(), 'tablenames' => 'tt_content', 'uid_foreign' => $record['uid'], 'fieldname' => 'media', 'sorting_foreign' => $i);
                if (isset($descriptions[$i])) {
                    $dataArray['description'] = $descriptions[$i];
                }
                if (isset($titleText[$i])) {
                    $dataArray['alternative'] = $titleText[$i];
                }
                $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $dataArray);
                unlink(PATH_site . 'uploads/media/' . $file);
            }
            $i++;
        }
        $this->cleanRecord($record, $i, $collections);
    }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:38,代码来源:TtContentUploadsUpdateWizard.php

示例13: 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:nicksergio,项目名称:TYPO3v4-Core,代码行数:14,代码来源:AbstractFile.php

示例14: setFileExtensionFilter

 /**
  * @return void
  */
 protected function setFileExtensionFilter()
 {
     // Don't inject the filter, because it's a prototype
     $this->fileExtensionFilter = $this->objectManager->get('TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter');
     $this->fileExtensionFilter->setAllowedFileExtensions($this->imageFileExtensions);
     $this->selectedStorage->addFileAndFolderNameFilter(array($this->fileExtensionFilter, 'filterFileList'));
 }
开发者ID:vertexvaar,项目名称:fal_gallery,代码行数:10,代码来源:GalleryController.php

示例15: getFileListHandsOverRecursiveTRUEifSet

 /**
  * @test
  */
 public function getFileListHandsOverRecursiveTRUEifSet()
 {
     $this->prepareFixture(array());
     $driver = $this->createDriverMock(array('basePath' => $this->getMountRootUrl()), $this->fixture, array('getFileList'));
     $driver->expects($this->once())->method('getFileList')->with($this->anything(), $this->anything(), $this->anything(), $this->anything(), $this->anything(), TRUE)->will($this->returnValue(array()));
     $this->fixture->getFileList('/', 0, 0, TRUE, TRUE, TRUE);
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:10,代码来源:ResourceStorageTest.php


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