/**
  * initializes this object
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->database = $GLOBALS['TYPO3_DB'];
     $fileFactory = ResourceFactory::getInstance();
     $this->storageObject = $fileFactory->getStorageObject($this->storageUid);
     $storageConfiguration = $this->storageObject->getConfiguration();
     $this->storageBasePath = $storageConfiguration['basePath'];
 }
Beispiel #2
0
 /**
  * Determines whether the passed storage object and record (sys_file_storage) can be
  * seen as equivalent during import.
  *
  * @param ResourceStorage $storageObject The storage object which should get compared
  * @param array $storageRecord The storage record which should get compared
  * @return bool Returns TRUE when both object storages can be seen as equivalent
  */
 protected function isEquivalentObjectStorage(ResourceStorage $storageObject, array $storageRecord)
 {
     // compare the properties: driver, writable and online
     if ($storageObject->getDriverType() === $storageRecord['driver'] && (bool) $storageObject->isWritable() === (bool) $storageRecord['is_writable'] && (bool) $storageObject->isOnline() === (bool) $storageRecord['is_online']) {
         $storageRecordConfiguration = ResourceFactory::getInstance()->convertFlexFormDataToConfigurationArray($storageRecord['configuration']);
         $storageObjectConfiguration = $storageObject->getConfiguration();
         // compare the properties: pathType and basePath
         if ($storageRecordConfiguration['pathType'] === $storageObjectConfiguration['pathType'] && $storageRecordConfiguration['basePath'] === $storageObjectConfiguration['basePath']) {
             return true;
         }
     }
     return false;
 }
 /**
  * @param ResourceStorage $storage
  * @return string
  */
 protected function getResourcesSourcePathByResourceStorage(ResourceStorage $storage)
 {
     $storageConfiguration = $storage->getConfiguration();
     if ($storageConfiguration['pathType'] === 'absolute') {
         $sourcePath = PathUtility::getCanonicalPath($storageConfiguration['basePath']) . '/';
     } else {
         $sourcePath = PathUtility::getCanonicalPath(PATH_site . $storageConfiguration['basePath']) . '/';
     }
     return $sourcePath;
 }