summaryrefslogtreecommitdiffstats
path: root/php-pear-1.10-restcache.patch
blob: 40d129ff663fa7c1535398e058dcf77b77b00056 (plain)
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
From fccb285ce442c710d9795d2a102b229799de4922 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Sun, 26 Jul 2015 08:08:23 +0200
Subject: [PATCH] allow pear to work when cache_dir is not writable

---
 PEAR/REST.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PEAR/REST.php b/PEAR/REST.php
index c5ed192..1e472b7 100644
--- a/PEAR/REST.php
+++ b/PEAR/REST.php
@@ -235,6 +235,13 @@ function saveCache($url, $contents, $lastmodified, $nochange = false, $cacheid =
             }
         }
 
+        if (!is_writeable($cache_dir)) {
+            // If writing to the cache dir is not going to work, silently do nothing.
+            // An ugly hack, but retains compat with PEAR 1.9.1 where many commands
+            // work fine as non-root user (w/out write access to default cache dir).
+            return true;
+        }
+
         if ($cacheid === null && $nochange) {
             $cacheid = unserialize(implode('', file($cacheidfile)));
         }