From fafd31d1de528d4e82b399fd33076031072a5171 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 23 Nov 2010 15:45:10 -0700 Subject: [PATCH] Suppress file access warnings --- framework/Cache/lib/Horde/Cache/Storage/File.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/framework/Cache/lib/Horde/Cache/Storage/File.php b/framework/Cache/lib/Horde/Cache/Storage/File.php index 47782be4c..7aa1e6f9b 100644 --- a/framework/Cache/lib/Horde/Cache/Storage/File.php +++ b/framework/Cache/lib/Horde/Cache/Storage/File.php @@ -74,7 +74,7 @@ class Horde_Cache_Storage_File extends Horde_Cache_Storage_Base $filename = $this->_dir . '/' . self::GC_FILE; $excepts = array(); - if (file_exists($filename)) { + if (is_readable($filename)) { $gc_file = file($filename, FILE_IGNORE_NEW_LINES); reset($gc_file); next($gc_file); @@ -110,11 +110,12 @@ class Horde_Cache_Storage_File extends Horde_Cache_Storage_Base } } - $fp = fopen($filename, 'w'); - foreach ($excepts as $key => $val) { - fwrite($fp, $key . "\t" . $val . "\n"); + if ($fp = @fopen($filename, 'w')) { + foreach ($excepts as $key => $val) { + fwrite($fp, $key . "\t" . $val . "\n"); + } + fclose($fp); } - fclose($fp); } /** -- 2.11.0