Backup a file before saving the new HTML contents
This commit is contained in:
parent
dfedd64ed5
commit
6804cc3776
1 changed files with 6 additions and 1 deletions
|
@ -41,8 +41,13 @@ class DownloadWebMention implements ShouldQueue
|
|||
//Laravel should catch and retry these automatically.
|
||||
if ($response->getStatusCode() == '200') {
|
||||
$filesystem = \Illuminate\FileSystem\FileSystem();
|
||||
$filename = $this->createFilenameFromURL($source);
|
||||
//backup file first
|
||||
if ($filesystem->exists($filename)) {
|
||||
$filesystem->copy($filename, $filename . '.' . date('Y-m-d') . '.backup');
|
||||
}
|
||||
$filesystem->put(
|
||||
$this->createFilenameFromURL($source),
|
||||
$filename,
|
||||
(string) $response->getBody()
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue