PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / trunk
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance vtrunk
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | vendor/rosell-dk/webp-convert/src/Convert/Converters/BaseTraits/DestinationPreparationTrait.php +5 -3 3.2.9 → 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 }