/** * Replaces a file with a local file (e.g. a freshly uploaded file) * * @param \TYPO3\CMS\Core\Resource\FileInterface $file * @param string $localFilePath * @return \TYPO3\CMS\Core\Resource\FileInterface */ public function replaceFile(\TYPO3\CMS\Core\Resource\FileInterface $file, $localFilePath) { if (!file_exists($localFilePath)) { throw new \InvalidArgumentException('File "' . $localFilePath . '" does not exist.', 1325842622); } // TODO check permissions $this->emitPreFileReplaceSignal($file, $localFilePath); $result = $this->driver->replaceFile($file, $localFilePath); $this->emitPostFileReplaceSignal($file, $localFilePath); return $result; }