/** * 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\Core\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\Core\Model\File\Storage::STORAGE_MEDIA_FILE_SYSTEM; $connectionName = ''; } return array('storage_type' => $storageType, 'connection_name' => $connectionName); }
/** * @param \Magento\Core\Model\File\Storage $storage * @param \Magento\Framework\App\Filesystem $filesystem * @param string $cacheFile */ public function __construct(\Magento\Core\Model\File\Storage $storage, \Magento\Framework\App\Filesystem $filesystem, $cacheFile) { $this->config = $storage->getScriptConfig(); $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem::PUB_DIR); $this->cacheFilePath = $cacheFile; }
/** * Retrieve storage model * * @param int|null $storage * @param array $params * @return \Magento\Framework\Model\AbstractModel|bool */ public function getStorageModel($storage = null, $params = array()) { return $this->_storage->getStorageModel($storage, $params); }