diff --git a/inc/cache.php b/inc/cache.php index 3c5dc058ea5c894aa9ac7dd03ea123244626db42..50ab799e7079a273d5c7dc8f13aa1c36861b2002 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -105,10 +105,10 @@ class cache { * cache $data * * @param string $data the data to be cached - * @return none + * @return bool true on success, false otherwise */ function storeCache($data) { - io_savefile($this->cache, $data); + return io_savefile($this->cache, $data); } /** @@ -286,6 +286,6 @@ class cache_instructions extends cache_parser { } function storeCache($instructions) { - io_savefile($this->cache,serialize($instructions)); + return io_savefile($this->cache,serialize($instructions)); } } diff --git a/inc/parserutils.php b/inc/parserutils.php index 66d1ae13cdc8847c06401121a77153f35d52dac6..c6518523914596a5c32b92004cfa99767abc33bd 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -183,8 +183,11 @@ function p_cached_instructions($file,$cacheonly=false,$id='') { } else if (@file_exists($file)) { // no cache - do some work $ins = p_get_instructions(io_readfile($file)); - $cache->storeCache($ins); - $run[$file] = true; // we won't rebuild these instructions in the same run again + if ($cache->storeCache($ins)) { + $run[$file] = true; // we won't rebuild these instructions in the same run again + } else { + msg('Unable to save cache file. Hint: disk full; file permissions; safe_mode setting.',-1); + } return $ins; }