Skip to content

Commit

Permalink
Merge branch '6.0' into 6
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed May 4, 2023
2 parents f56327d + 8555524 commit cc220c3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
9 changes: 8 additions & 1 deletion src/Publisher/FilesystemPublisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cc220c3

Please sign in to comment.