Fix typo in favicon template filename
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 17 Nov 2020 14:25:44 +0000 (15:25 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 17 Nov 2020 14:26:53 +0000 (15:26 +0100)
5.2 used `favicon-template.ext` instead of `favicon.template.ext`.

com.woltlab.wcf/package.xml
wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3.1_faviconTemplate.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php
wcfsetup/install/files/lib/data/style/StyleAction.class.php

index 04af14992eea0c218a5a3c48b30fe347a3701dc5..ba1895d807bb57257f56d917aeb275e46703f447 100644 (file)
        </instructions>
        
        <!-- Run the option.xml update for 5.3.0 -> 5.3.1, due to the missing removal of external_link_rel_nofollow. -->
+       <!-- Run update_com.woltlab.wcf_5.3.1_faviconTemplate.php for 5.3.0 -> 5.3.1 -->
 </package>
diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3.1_faviconTemplate.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.3.1_faviconTemplate.php
new file mode 100644 (file)
index 0000000..79465a3
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+
+use wcf\data\style\StyleList;
+
+/**
+ * @author     Tim Duesterhus
+ * @copyright  2001-2020 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core
+ */
+
+$styleList = new StyleList();
+$styleList->readObjects();
+
+foreach ($styleList as $style) {
+       foreach ([
+               'gif',
+               'jpeg',
+               'jpg',
+               'png',
+       ] as $extension) {
+               if (file_exists($style->getAssetPath() . 'favicon.template.' . $extension)) {
+                       rename(
+                               $style->getAssetPath() . 'favicon.template.' . $extension,
+                               $style->getAssetPath() . 'favicon-template.' . $extension
+                       );
+               }
+       }
+}
index 8077990a5c6f9c6b14939353fb7d1d5ac34ef7fa..04225a5a9d99c97c219d07dded42cf47d862a0a3 100644 (file)
@@ -203,7 +203,7 @@ class StyleEditForm extends StyleAddForm {
                        }
                        if ($this->style->hasFavicon) {
                                foreach (['png', 'jpg', 'gif'] as $extension) {
-                                       $filename = "favicon.template.".$extension;
+                                       $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', [
index 4bf7800b3a16774518080c3ee3d49b02d0333e58..c7b866ba44268f1e3520775993437f9652e3164f 100644 (file)
@@ -324,7 +324,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                                        throw new \InvalidArgumentException('The given favicon is not an image');
                                }
                                $extension = ImageUtil::getExtensionByMimeType($imageData['mime']);
-                               $newName = "favicon.template.".$extension;
+                               $newName = "favicon-template.".$extension;
                                $newLocation = $style->getAssetPath().$newName;
                                rename($fileLocation, $newLocation);
                                
@@ -358,8 +358,8 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                                }
                                unlink($style->getAssetPath()."favicon.ico");
                                foreach (['png', 'jpg', 'gif'] as $extension) {
-                                       if (file_exists($style->getAssetPath()."favicon.template.".$extension)) {
-                                               unlink($style->getAssetPath()."favicon.template.".$extension);
+                                       if (file_exists($style->getAssetPath()."favicon-template.".$extension)) {
+                                               unlink($style->getAssetPath()."favicon-template.".$extension);
                                        }
                                }
                                (new StyleEditor($style))->update([