Create asset path when creating a style
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 20 Jul 2020 12:48:04 +0000 (14:48 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 21 Jul 2020 11:55:11 +0000 (13:55 +0200)
wcfsetup/install/files/lib/data/style/StyleEditor.class.php

index c3a4c1fb705bb70d8f2f46131c4a3ec7094ae68a..c86e8bdd70e9335f0c5f7380ee56e2c5b5cc9e24 100644 (file)
@@ -1059,6 +1059,13 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                $style = parent::create($parameters);
                $styleEditor = new StyleEditor($style);
                
+               // create asset path
+               FileUtil::makePath($style->getAssetPath());
+               
+               $styleEditor->update([
+                       'imagePath' => FileUtil::getRelativePath(WCF_DIR, $style->getAssetPath()),
+               ]);
+               
                // save variables
                if ($variables !== null) {
                        $styleEditor->setVariables($variables);