diff --git a/README.md b/README.md index 9f32a328..7ad1d1c3 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,12 @@ [![CI](https://github.com/silverstripe/silverstripe-staticpublishqueue/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-staticpublishqueue/actions/workflows/ci.yml) [![Silverstripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/) +## Installation + +```sh +composer require silverstripe/staticpublishqueue +``` + ## Brief This module provides an API for your project to be able to generate a static cache of your pages to enhance @@ -12,14 +18,6 @@ It generates the cache files using the [QueuedJobs module](https://github.com/sy [Docs](docs/en/index.md) -## Requirements - -* "silverstripe/framework": "^5", -* "silverstripe/cms": "^5", -* "silverstripe/config": "^2", -* "symbiote/silverstripe-queuedjobs": "^5", -* "silverstripe/versioned": "^2" - ## Unit-testing with StaticPublisherState to disable queuedjobs for unit-tests You can use `StaticPublisherState` to disable queuejobs job queueing and logging in unit-testing to improve performance. diff --git a/src/Publisher/FilesystemPublisher.php b/src/Publisher/FilesystemPublisher.php index 9a335f89..ca9084fd 100644 --- a/src/Publisher/FilesystemPublisher.php +++ b/src/Publisher/FilesystemPublisher.php @@ -190,7 +190,14 @@ protected function saveToPath($content, $filePath) $publishPath = $this->getDestPath() . DIRECTORY_SEPARATOR . $filePath; Filesystem::makeFolder(dirname($publishPath)); - return rename($temporaryPath, $publishPath); + // Attempt to copy this file to its permanent location + $copyResult = copy($temporaryPath, $publishPath); + // We want to unlink the temporary file regardless of copy() success, as new temporary files would be created + // when this action is attempted again + unlink($temporaryPath); + + // Return copy() result + return $copyResult; } protected function deleteFromPath($filePath)