Unbreak WCFSetup
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 24 Jul 2020 12:13:48 +0000 (14:13 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 24 Jul 2020 12:14:13 +0000 (14:14 +0200)
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/files/lib/system/package/plugin/StylePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/style/StyleCompiler.class.php

index 276d5fc7f7cdd89137ad129a94dd5884a3c2c0ce..8ac5f06fe31145f032b2ad0a725ab1c6577aab71 100644 (file)
@@ -362,9 +362,10 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
         * @param       string          $filename
         * @param       integer         $packageID
         * @param       StyleEditor     $style
+        * @param       boolean         $skipFontDownload
         * @return      StyleEditor
         */
-       public static function import($filename, $packageID = 1, StyleEditor $style = null) {
+       public static function import($filename, $packageID = 1, StyleEditor $style = null, $skipFontDownload = false) {
                // open file
                $tar = new Tar($filename);
                
@@ -659,14 +660,16 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                        }
                }
                
-               // download google fonts
-               $fontManager = FontManager::getInstance();
-               $family = $style->getVariable('wcfFontFamilyGoogle');
-               try {
-                       $fontManager->downloadFamily($family);
-               }
-               catch (FontDownloadFailed $e) {
-                       // ignore
+               if (!$skipFontDownload) {
+                       // download google fonts
+                       $fontManager = FontManager::getInstance();
+                       $family = $style->getVariable('wcfFontFamilyGoogle');
+                       try {
+                               $fontManager->downloadFamily($family);
+                       }
+                       catch (FontDownloadFailed $e) {
+                               // ignore
+                       }
                }
 
                $tar->close();
index 6b2cd2bd962655e6490ffa11256e0cb11290c936..5c67bb0419a9ac718c31951194fc5baa6fd61eed 100644 (file)
@@ -32,7 +32,7 @@ class StylePackageInstallationPlugin extends AbstractPackageInstallationPlugin {
                $styleEditor = StyleHandler::getInstance()->getStyleByName($this->installation->getPackageName(), false);
                
                // import style
-               $style = StyleEditor::import($filename, $this->installation->getPackageID(), $styleEditor);
+               $style = StyleEditor::import($filename, $this->installation->getPackageID(), $styleEditor, !PACKAGE_ID);
                
                // set style as default
                if (isset($this->instruction['attributes']['default'])) {
index 534d696a9b1d3f38a8c84f307fdd3229ce43280c..354ae05928c30396b373eec547f06c13880779f7 100644 (file)
@@ -275,7 +275,7 @@ class StyleCompiler extends SingletonFactory {
                }
                
                // add google fonts
-               if (!empty($variables['wcfFontFamilyGoogle'])) {
+               if (!empty($variables['wcfFontFamilyGoogle']) && PACKAGE_ID) {
                        $cssFile = FontManager::getInstance()->getCssFilename(substr($variables['wcfFontFamilyGoogle'], 1, -1));
                        if (is_readable($cssFile)) {
                                $content .= file_get_contents($cssFile);