← All changes
|
vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php
+5
-3
3.2.5
→
trunk
View file →
| @@ -68,10 +68,12 @@ | ||
| 68 | 68 | // The above might fail on Windows, even though dir is writable |
| 69 | 69 | // So, to be absolute sure that we cannot write, we make an actual write test (writing a dummy file) |
| 70 | 70 | // No harm in doing that for non-Windows systems either. |
| 71 | 71 | if (file_put_contents($destination, 'dummy') !== false) { |
| 72 | - // all is well, after all | |
| 73 | - unlink($destination); | |
| 72 | + if (file_exists($destination)) { | |
| 73 | + // all is well, after all | |
| 74 | + unlink($destination); | |
| 75 | + } | |
| 74 | 76 | return; |
| 75 | 77 | } |
| 76 | 78 | |
| 77 | 79 | throw new CreateDestinationFileException( |
| @@ -90,9 +92,9 @@ | ||
| 90 | 92 | $destination = $this->getDestination(); |
| 91 | 93 | if (file_exists($destination)) { |
| 92 | 94 | // A file already exists in this folder... |
| 93 | 95 | // We delete it, to make way for a new webp |
| 94 | - if (!unlink($destination)) { | |
| 96 | + if (!@unlink($destination)) { | |
| 95 | 97 | throw new CreateDestinationFileException( |
| 96 | 98 | 'Existing file cannot be removed: ' . basename($destination) |
| 97 | 99 | ); |
| 98 | 100 | } |