</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 -->
+ <!-- Run update_com.woltlab.wcf_5.3.1_style.php for 5.3.0 -> 5.3.1 -->
<!-- Add a note about the updated CSS in email_html.tpl to the release notes:
https://github.com/WoltLab/WCF/commit/1ac55ad408d5bfab4f69714c6259cc5d09ceb344
Administrators are highly encouraged to apply the CSS adjustments to their custom template version.
+++ /dev/null
-<?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
- );
- }
- }
-}
--- /dev/null
+<?php
+
+use wcf\data\style\StyleEditor;
+use wcf\data\style\StyleList;
+use wcf\util\FileUtil;
+
+/**
+ * @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) {
+ $styleEditor = new StyleEditor($style);
+
+ // Fix the name of the favicon template.
+ 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
+ );
+ }
+ }
+
+ // Fix the style preview.
+ if (
+ $style->image === basename($style->image) &&
+ file_exists($style->getAssetPath() . $style->image)
+ ) {
+ $styleEditor->update([
+ 'image' => FileUtil::getRelativePath(WCF_DIR.'images/', $style->getAssetPath()) . $style->image,
+ ]);
+ }
+
+ if (
+ $style->image2x === basename($style->image2x) &&
+ file_exists($style->getAssetPath() . $style->image2x)
+ ) {
+ $styleEditor->update([
+ 'image2x' => FileUtil::getRelativePath(WCF_DIR.'images/', $style->getAssetPath()) . $style->image2x,
+ ]);
+ }
+}
// Moving *should* be safe here, unless the admin manually edited the style, but better play safe.
if ($style->image && file_exists(WCF_DIR . 'images/' . $style->image)) {
$extension = pathinfo($style->image, PATHINFO_EXTENSION);
+ $newName = 'stylePreview.' . $extension;
copy(
WCF_DIR . 'images/' . $style->image,
- $style->getAssetPath() . 'stylePreview.' . $extension
+ $style->getAssetPath() . $newName
);
$styleEditor->update([
- 'image' => 'stylePreview.' . $extension,
+ 'image' => FileUtil::getRelativePath(WCF_DIR.'images/', $style->getAssetPath()) . $newName,
]);
}
if ($style->image2x && file_exists(WCF_DIR . 'images/' . $style->image2x)) {
$extension = pathinfo($style->image2x, PATHINFO_EXTENSION);
+ $newName = 'stylePreview@2x.' . $extension;
copy(
WCF_DIR . 'images/' . $style->image2x,
- $style->getAssetPath() . 'stylePreview@2x.' . $extension
+ $style->getAssetPath() . $newName
);
$styleEditor->update([
- 'image2x' => 'stylePreview@2x.' . $extension,
+ 'image2x' => FileUtil::getRelativePath(WCF_DIR.'images/', $style->getAssetPath()) . $newName,
]);
}