/**
  * Retrieve last sync params settings
  *
  * Return array format:
  * array (
  *  => storage_type     int,
  *  => connection_name  string
  * )
  *
  * @return array
  */
 public function getSyncStorageParams()
 {
     $flag = $this->_fileStorage->getSyncFlag();
     $flagData = $flag->getFlagData();
     if ($flag->getState() == \Magento\MediaStorage\Model\File\Storage\Flag::STATE_NOTIFIED && is_array($flagData) && isset($flagData['destination_storage_type']) && $flagData['destination_storage_type'] != '' && isset($flagData['destination_connection_name'])) {
         $storageType = $flagData['destination_storage_type'];
         $connectionName = $flagData['destination_connection_name'];
     } else {
         $storageType = \Magento\MediaStorage\Model\File\Storage::STORAGE_MEDIA_FILE_SYSTEM;
         $connectionName = '';
     }
     return ['storage_type' => $storageType, 'connection_name' => $connectionName];
 }
Example #2
0
 /**
  * @param \Magento\MediaStorage\Model\File\Storage $storage
  * @param \Magento\Framework\Filesystem $filesystem
  * @param string $cacheFile
  */
 public function __construct(\Magento\MediaStorage\Model\File\Storage $storage, \Magento\Framework\Filesystem $filesystem, $cacheFile)
 {
     $this->config = $storage->getScriptConfig();
     $this->rootDirectory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
     $this->cacheFilePath = $cacheFile;
 }
Example #3
0
 /**
  * Retrieve storage model
  *
  * @param  int|null $storage
  * @param  array $params
  * @return \Magento\Framework\Model\AbstractModel|bool
  */
 public function getStorageModel($storage = null, $params = [])
 {
     return $this->_storage->getStorageModel($storage, $params);
 }