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
|
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
---
src/Dompdf.php | 4 ++--
src/Image/Cache.php | 4 ++--
src/Options.php | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/Dompdf.php b/src/Dompdf.php
index d0a6884..a628179 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/Image/Cache.php b/src/Image/Cache.php
index 6141cb5..d01fc1b 100644
--- a/src/Image/Cache.php
+++ b/src/Image/Cache.php
@@ -249,6 +249,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 c065bff..5ca1707 100644
--- a/src/Options.php
+++ b/src/Options.php
@@ -311,16 +311,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";
|