/** * Returns the render instructions for a file * * Uses and creates a serialized cache file * * @author Andreas Gohr <*****@*****.**> */ function p_cached_instructions($file, $cacheonly = false, $id = '') { global $conf; static $run = null; if (is_null($run)) { $run = array(); } $cache = new cache_instructions($id, $file); if ($cacheonly || $cache->useCache() || isset($run[$file])) { return $cache->retrieveCache(); } else { if (@file_exists($file)) { // no cache - do some work $ins = p_get_instructions(io_readWikiPage($file, $id)); 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; } } return null; }
/** * Returns the render instructions for a file * * Uses and creates a serialized cache file * * @author Andreas Gohr <*****@*****.**> */ function p_cached_instructions($file, $cacheonly = false, $id = '') { global $conf; $cache = new cache_instructions($id, $file); if ($cacheonly || $cache->useCache()) { return $cache->retrieveCache(); } else { if (@file_exists($file)) { // no cache - do some work $ins = p_get_instructions(io_readfile($file)); $cache->storeCache($ins); return $ins; } } return NULL; }