Neos\Flow\ResourceManagement\Storage\WritableFileSystemStorage::importTemporaryFile PHP Method

importTemporaryFile() protected method

Note: the temporary file is (re-)moved by this method.
protected importTemporaryFile ( string $temporaryPathAndFileName, string $collectionName ) : PersistentResource
$temporaryPathAndFileName string
$collectionName string
return Neos\Flow\ResourceManagement\PersistentResource
    protected function importTemporaryFile($temporaryPathAndFileName, $collectionName)
    {
        $this->fixFilePermissions($temporaryPathAndFileName);
        $sha1Hash = sha1_file($temporaryPathAndFileName);
        $targetPathAndFilename = $this->getStoragePathAndFilenameByHash($sha1Hash);
        if (!is_file($targetPathAndFilename)) {
            $this->moveTemporaryFileToFinalDestination($temporaryPathAndFileName, $targetPathAndFilename);
        } else {
            unlink($temporaryPathAndFileName);
        }
        $resource = new PersistentResource();
        $resource->setFileSize(filesize($targetPathAndFilename));
        $resource->setCollectionName($collectionName);
        $resource->setSha1($sha1Hash);
        $resource->setMd5(md5_file($targetPathAndFilename));
        return $resource;
    }