DRY up handling of existing favicon in StyleEditForm
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 24 Jul 2020 09:19:48 +0000 (11:19 +0200)
committerGitHub <noreply@github.com>
Fri, 24 Jul 2020 09:19:48 +0000 (11:19 +0200)
Co-authored-by: Alexander Ebert <ebert@woltlab.com>
wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php

index 9bf83bd51ab6c59793eb4b20646717d81c32c622..8e262b0afc6b8da7f519261131d8f4ce1c9fa026 100644 (file)
@@ -172,8 +172,9 @@ class StyleEditForm extends StyleAddForm {
                        }
                        if ($this->style->hasFavicon) {
                                foreach (['png', 'jpg', 'gif'] as $extension) {
-                                       if (file_exists($this->style->getAssetPath()."favicon.template.".$extension)) {
-                                               $file = new UploadFile($this->style->getAssetPath()."favicon.template.".$extension, "favicon.template.".$extension, true, true, false);
+                                       $filename = "favicon.template.".$extension;
+                                       if (file_exists($this->style->getAssetPath().$filename)) {
+                                               $file = new UploadFile($this->style->getAssetPath().$filename, $filename, true, true, false);
                                                UploadHandler::getInstance()->registerFilesByField('favicon', [
                                                        $file,
                                                ]);