File: 0020-Patch-the-tmp-folder-to-MATOMO_TMP_PATH.patch

package info (click to toggle)
matomo 5.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 72,652 kB
  • sloc: php: 230,070; javascript: 103,748; python: 196; xml: 188; sh: 156; makefile: 13; sql: 10
file content (80 lines) | stat: -rw-r--r-- 3,470 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
From: William Desportes <williamdes@wdes.fr>
Date: Sun, 15 Dec 2024 23:54:43 +0100
Subject: Patch the tmp folder to MATOMO_TMP_PATH

Origin: vendor
Forwarded: not-needed
---
 config/environment/test.php                                      | 2 +-
 config/global.php                                                | 2 +-
 core/Config/Cache.php                                            | 2 +-
 core/Profiler.php                                                | 2 +-
 plugins/Diagnostics/Diagnostic/RecommendedPrivateDirectories.php | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/config/environment/test.php b/config/environment/test.php
index 9a69645..3377007 100644
--- a/config/environment/test.php
+++ b/config/environment/test.php
@@ -134,7 +134,7 @@ return array(
         })),
 
         array('Test.Mail.send', \Piwik\DI::value(function (\PHPMailer\PHPMailer\PHPMailer $mail) {
-            $outputFile = PIWIK_INCLUDE_PATH . '/tmp/' . Piwik::getModule() . '.' . Piwik::getAction() . '.mail.json';
+            $outputFile = MATOMO_TMP_PATH . '/' . Piwik::getModule() . '.' . Piwik::getAction() . '.mail.json';
             $outputContent = str_replace("=\n", "", $mail->Body ?: $mail->AltBody);
             $outputContent = str_replace("=0A", "\n", $outputContent);
             $outputContent = str_replace("=3D", "=", $outputContent);
diff --git a/config/global.php b/config/global.php
index f2d87b5..2f1b3dd 100644
--- a/config/global.php
+++ b/config/global.php
@@ -25,7 +25,7 @@ return [
         $general = $config->General;
         $tmp = empty($general['tmp_path']) ? '/tmp' : $general['tmp_path'];
 
-        return $root . $tmp . $instanceId;
+        return MATOMO_TMP_PATH . '/' . $instanceId;
     },
 
     'path.tmp.templates' => Piwik\DI::string('{path.tmp}/templates_c'),
diff --git a/core/Config/Cache.php b/core/Config/Cache.php
index 11ea22a..325a359 100644
--- a/core/Config/Cache.php
+++ b/core/Config/Cache.php
@@ -34,7 +34,7 @@ class Cache extends File
 
     private function makeCacheDir($host)
     {
-        return PIWIK_INCLUDE_PATH . '/tmp/' . $host . '/cache/tracker';
+        return MATOMO_TMP_PATH . '/' . $host . '/cache/tracker';
     }
 
     public static function hasHostConfig($mergedConfigSettings)
diff --git a/core/Profiler.php b/core/Profiler.php
index c8339d2..aaf5178 100644
--- a/core/Profiler.php
+++ b/core/Profiler.php
@@ -386,6 +386,6 @@ class Profiler
      */
     private static function getPathToXHProfRunIds()
     {
-        return PIWIK_INCLUDE_PATH . '/tmp/cache/tests-xhprof-runs';
+        return MATOMO_TMP_PATH . '/cache/tests-xhprof-runs';
     }
 }
diff --git a/plugins/Diagnostics/Diagnostic/RecommendedPrivateDirectories.php b/plugins/Diagnostics/Diagnostic/RecommendedPrivateDirectories.php
index f48ba40..45f6e65 100644
--- a/plugins/Diagnostics/Diagnostic/RecommendedPrivateDirectories.php
+++ b/plugins/Diagnostics/Diagnostic/RecommendedPrivateDirectories.php
@@ -21,8 +21,8 @@ class RecommendedPrivateDirectories extends AbstractPrivateDirectories
     public function __construct(Translator $translator)
     {
         parent::__construct($translator);
-        Filesystem::mkdir(PIWIK_INCLUDE_PATH . '/tmp');
-        file_put_contents(PIWIK_INCLUDE_PATH . '/tmp/empty', 'test');
+        Filesystem::mkdir(MATOMO_TMP_PATH);
+        file_put_contents(MATOMO_TMP_PATH . '/empty', 'test');
     }
 
     protected function addError(DiagnosticResult &$result)