Only rebuild favicons if there is a new image uploaded
authorjoshuaruesweg <ruesweg@woltlab.com>
Fri, 4 Dec 2020 10:05:10 +0000 (11:05 +0100)
committerjoshuaruesweg <ruesweg@woltlab.com>
Fri, 4 Dec 2020 10:05:10 +0000 (11:05 +0100)
wcfsetup/install/files/lib/data/style/StyleAction.class.php

index ca31cf52393e0bd4532a61a1fe854a5fef47c449..820bd5f2ad3e8ae400e6deb5a78e8e77592d4510 100644 (file)
@@ -322,7 +322,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                        /** @var \wcf\system\file\upload\UploadFile $file */
                        $file = $this->parameters['uploads']['favicon'];
                        
-                       if ($file !== null) {
+                       if ($file !== null && !$file->isProcessed()) {
                                $fileLocation = $file->getLocation();
                                if (($imageData = getimagesize($fileLocation)) === false) {
                                        throw new \InvalidArgumentException('The given favicon is not an image');
@@ -356,7 +356,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                                $file->setProcessed($newLocation);
                                $hasFavicon = true;
                        }
-                       else {
+                       else if ($file === null) {
                                foreach ($images as $filename => $length) {
                                        unlink($style->getAssetPath().$filename);
                                }