config = $storage->getScriptConfig(); $this->rootDirectory = $filesystem->getDirectoryWrite(DirectoryList::ROOT); $this->cacheFilePath = $cacheFile; } /** * Retrieve media directory * * @return string */ public function getMediaDirectory() { return $this->config['media_directory']; } /** * Retrieve list of allowed resources * * @return array */ public function getAllowedResources() { return $this->config['allowed_resources']; } /** * Save config in cache file * * @return void */ public function save() { /** @var Write $file */ $file = $this->rootDirectory->openFile($this->rootDirectory->getRelativePath($this->cacheFilePath), 'w'); try { $file->lock(); $file->write(json_encode($this->config)); $file->unlock(); $file->close(); } catch (FileSystemException $e) { $file->close(); } } }