Projekt

Allgemein

Profil

GX-Bug #63108 » ThemeFontFix.patch

Till Tepelmann, 03.07.2019 19:21

Unterschiede anzeigen:

src/GXMainComponents/Services/System/Theme/Repositories/ThemeWriter.inc.php (date 1562002998000)
248 248
        $this->_copyCustomStylesDirectory($theme->getId(), $theme->getCustomStyles(), $destination);
249 249

  
250 250
        $this->_copyThemeImagesDirectory($theme->getId(), $theme->getImages(), $destination);
251
        
252
        $this->_copyThemeFontsDirectory($theme->getId(), $theme->getFonts(), $destination);
251 253

  
252 254
        $this->_copyStyleEditThemeDirectory($theme->getId(), $theme->getStyleEdit(), $destination);
253 255
    }
......
585 587
                $sourcePath = $this->_getRelative($imagesDirectory->getRoot());
586 588
                $destinationPath = $this->_getRelative($destination) . $this->_stringAfter($themeName, $sourcePath);
587 589

  
590
                $sourceFile = $sourcePath . DIRECTORY_SEPARATOR . $file;
591
                $destinationFile = $destinationPath . DIRECTORY_SEPARATOR . $file;
592

  
593
                try {
594
                    $this->filesystem->copy($sourceFile, $destinationFile);
595
                } catch (FileExistsException $e) {
596
                    $this->filesystem->delete($destinationFile);
597
                    $this->filesystem->copy($sourceFile, $destinationFile);
598
                } catch (FileNotFoundException $e) {
599
                }
600
            }
601
        }
602
    }
603
    
604
    /**
605
     * @param ThemeId $themeId
606
     * @param                              $fontsDirectory
607
     * @param ThemeDirectoryRootInterface $destination
608
     *
609
     * @throws FileNotFoundException
610
     */
611
    protected function _copyThemeFontsDirectory(
612
        ThemeId $themeId,
613
        $fontsDirectory,
614
        ThemeDirectoryRootInterface $destination
615
    ) {
616
        if ($fontsDirectory instanceof ThemeDirectoryInterface) {
617
            $childDirectories = $fontsDirectory->getChildren();
618
            if ($childDirectories) {
619
                foreach ($childDirectories as $childDirectory) {
620
                    $this->_copyThemeFontsDirectory($themeId, $childDirectory, $destination);
621
                }
622
            }
623
            
624
            foreach ($fontsDirectory->getFiles() as $file) {
625
                $themeName = $themeId->getId();
626
                $sourcePath = $this->_getRelative($fontsDirectory->getRoot());
627
                $destinationPath = $this->_getRelative($destination) . $this->_stringAfter($themeName, $sourcePath);
628
                
588 629
                $sourceFile = $sourcePath . DIRECTORY_SEPARATOR . $file;
589 630
                $destinationFile = $destinationPath . DIRECTORY_SEPARATOR . $file;
590

  
631
                
591 632
                try {
592 633
                    $this->filesystem->copy($sourceFile, $destinationFile);
593 634
                } catch (FileExistsException $e) {
src/GXMainComponents/Services/System/Theme/ValueObjects/Interfaces/ThemeDirectoriesInterface.inc.php (date 1562002880000)
69 69
     * @return \ThemeDirectory|null
70 70
     */
71 71
    public function getImages();
72
    
73
    /**
74
     * Returns the fonts directory.
75
     *
76
     * @return \ThemeDirectory|null
77
     */
78
    public function getFonts();
72 79

  
73 80

  
74 81
    /**
src/GXMainComponents/Services/System/Theme/ValueObjects/ThemeDirectories.inc.php (date 1562171451000)
63 63
     * @var ThemeDirectory|null
64 64
     */
65 65
    protected $images;
66
    
67
    /**
68
     * Fonts directory
69
     *
70
     * @var ThemeDirectory|null
71
     */
72
    protected $fonts;
66 73

  
67 74
    /**
68 75
     * Custom HTML directory
......
106 113
        $this->customStyles = $this->tryBuildThemeDirectory($root, 'styles' . DIRECTORY_SEPARATOR . 'custom');
107 114

  
108 115
        $this->images = $this->tryBuildThemeDirectory($root, 'images');
116
        $this->fonts = $this->tryBuildThemeDirectory($root, 'fonts');
109 117
    }
110 118

  
111 119

  
......
214 222
    {
215 223
        return $this->images;
216 224
    }
225
    
226
    /**
227
     * Returns the fonts directory.
228
     *
229
     * @return \ThemeDirectory|null
230
     */
231
    public function getFonts()
232
    {
233
        return $this->fonts;
234
    }
217 235

  
218 236

  
219 237
    /**
src/GXMainComponents/Services/System/Theme/ValueObjects/Theme.inc.php (date 1562002855000)
196 196
    {
197 197
        return $this->directories->getImages();
198 198
    }
199
    
200
    /**
201
     * Returns the fonts directory.
202
     *
203
     * @return \ThemeDirectory|null
204
     */
205
    public function getFonts()
206
    {
207
        return $this->directories->getFonts();
208
    }
199 209

  
200 210

  
201 211
    /**
    (1-1/1)