From 008eef17c09cc7f9ab9c8d474de744679bd8a45d Mon Sep 17 00:00:00 2001
From: Fabrixxm <fabrix.xm@gmail.com>
Date: Mon, 21 Oct 2013 14:03:01 -0400
Subject: [PATCH] clear_cache() check if cache dir is writable before opening
 it

---
 boot.php | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/boot.php b/boot.php
index 57414e8fcf..2b58d805a5 100644
--- a/boot.php
+++ b/boot.php
@@ -2156,6 +2156,7 @@ function clear_cache($basepath = "", $path = "") {
 	if ($cachetime == 0)
 		$cachetime = 86400;
 
+	if (is_writable($path)){
 	if ($dh = opendir($path)) {
 		while (($file = readdir($dh)) !== false) {
 			$fullpath = $path."/".$file;
@@ -2166,6 +2167,7 @@ function clear_cache($basepath = "", $path = "") {
 		}
 		closedir($dh);
 	}
+	}
 }
 
 function set_template_engine(&$a, $engine = 'internal') {