File: 0002-Change-dir-variables-to-debian-dirs.patch

package info (click to toggle)
php-dompdf 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,848 kB
  • sloc: php: 26,450; sh: 109; xml: 100; makefile: 42
file content (109 lines) | stat: -rw-r--r-- 4,269 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
From: William Desportes <williamdes@wdes.fr>
Date: Thu, 2 Feb 2023 15:54:11 +0100
Subject: Change directory variables to Debian folders

Origin: vendor
Forwarded: not-needed
---
 lib/Cpdf.php           |  2 +-
 src/Adapter/PDFLib.php |  2 +-
 src/Dompdf.php         |  4 ++--
 src/FontMetrics.php    |  2 +-
 src/Image/Cache.php    |  4 ++--
 src/Options.php        | 12 ++++++------
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/Cpdf.php b/lib/Cpdf.php
index 68a08aa..651cbbc 100644
--- a/lib/Cpdf.php
+++ b/lib/Cpdf.php
@@ -3090,7 +3090,7 @@ EOT;
     {
         $this->pdfa = true;
 
-        $iccProfilePath = __DIR__ . '/res/sRGB2014.icc';
+        $iccProfilePath = '/usr/share/color/icc/sRGB.icc';
         $this->o_catalog($this->catalogId, 'outputIntents', [
             'iccProfileData' => file_get_contents($iccProfilePath),
             'iccProfileName' => basename($iccProfilePath),
diff --git a/src/Adapter/PDFLib.php b/src/Adapter/PDFLib.php
index 37e2749..ab83a3b 100644
--- a/src/Adapter/PDFLib.php
+++ b/src/Adapter/PDFLib.php
@@ -259,7 +259,7 @@ class PDFLib implements Canvas
         }
 
         if ($options->isPdfAEnabled()) {
-            $iccProfilePath = $options->getRootDir() . '/lib/res/sRGB2014.icc';
+            $iccProfilePath = '/usr/share/color/icc/sRGB.icc';
             $this->_pdf->load_iccprofile($iccProfilePath, "usage=outputintent");
         }
 
diff --git a/src/Dompdf.php b/src/Dompdf.php
index b0d319f..cf5505c 100644
--- a/src/Dompdf.php
+++ b/src/Dompdf.php
@@ -258,8 +258,8 @@ class Dompdf
             $this->setOptions(new Options());
         }
 
-        $versionFile = realpath(__DIR__ . '/../VERSION');
-        if (($version = file_get_contents($versionFile)) !== false) {
+        $versionFile = '/usr/share/php/dompdf/VERSION';
+        if (file_exists($versionFile) && ($version = file_get_contents($versionFile)) !== false) {
             $version = trim($version);
             if ($version !== '$Format:<%h>$') {
                 $this->version = sprintf('dompdf %s', $version);
diff --git a/src/FontMetrics.php b/src/FontMetrics.php
index 52cc3c7..9adfdb0 100644
--- a/src/FontMetrics.php
+++ b/src/FontMetrics.php
@@ -113,7 +113,7 @@ class FontMetrics
      */
     public function loadFontFamilies()
     {
-        $file = $this->options->getRootDir() . "/lib/fonts/installed-fonts.dist.json";
+        $file = $this->options->getFontDir() . "/installed-fonts.dist.json";
         $this->bundledFonts = json_decode(file_get_contents($file), true);
 
         if (is_readable($this->getUserFontsFilePath())) {
diff --git a/src/Image/Cache.php b/src/Image/Cache.php
index 922a063..9b5aaf5 100644
--- a/src/Image/Cache.php
+++ b/src/Image/Cache.php
@@ -282,6 +282,6 @@ class Cache
     }
 }
 
-if (file_exists(realpath(__DIR__ . "/../../lib/res/broken_image.svg"))) {
-    Cache::$broken_image = realpath(__DIR__ . "/../../lib/res/broken_image.svg");
+if (file_exists('/usr/share/php/dompdf/lib/res/broken_image.svg')) {
+    Cache::$broken_image = '/usr/share/php/dompdf/lib/res/broken_image.svg';
 }
diff --git a/src/Options.php b/src/Options.php
index bdd2841..53434b5 100644
--- a/src/Options.php
+++ b/src/Options.php
@@ -347,16 +347,16 @@ class Options
      */
     public function __construct(?array $attributes = null)
     {
-        $rootDir = realpath(__DIR__ . "/../");
+        $rootDir = '/usr/share/php/dompdf';
         $this->setChroot(array($rootDir));
         $this->setRootDir($rootDir);
-        $this->setTempDir(sys_get_temp_dir());
-        $this->setFontDir($rootDir . "/lib/fonts");
-        $this->setFontCache($this->getFontDir());
+        $this->setTempDir('/var/cache/php-dompdf/tmp');
+        $this->setFontDir('/usr/share/php/dompdf/lib/fonts');
+        $this->setFontCache('/var/cache/php-dompdf/fonts/');
 
         $ver = "";
-        $versionFile = realpath(__DIR__ . '/../VERSION');
-        if (($version = file_get_contents($versionFile)) !== false) {
+        $versionFile = '/usr/share/php/dompdf/VERSION';
+        if (file_exists($versionFile) && ($version = file_get_contents($versionFile)) !== false) {
             $version = trim($version);
             if ($version !== '$Format:<%h>$') {
                 $ver = "/$version";