* by adapting the p_cached_xhtml function in dokuwiki * */ function p_sidebar_cached_xhtml($localFile, $masterFile){ global $conf; $cache = getCacheName($localFile.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],'.xhtml'); $purge = $conf['cachedir'].'/purgefile'; // check if cache can be used $cachetime = @filemtime($cache); // 0 if not exists if( @file_exists($masterFile) // does the source exist && $cachetime > @filemtime($masterFile) // cache is fresh && ((time() - $cachetime) < $conf['cachetime']) // and is cachefile young enough && !isset($_REQUEST['purge']) // no purge param was set && ($cachetime > @filemtime($purge)) // and newer than the purgefile && ($cachetime > @filemtime(DOKU_INC.'conf/dokuwiki.php')) // newer than the config file && ($cachetime > @filemtime(DOKU_INC.'conf/local.php')) // newer than the local config file && ($cachetime > @filemtime(DOKU_INC.'inc/parser/xhtml.php')) // newer than the renderer && ($cachetime > @filemtime(DOKU_INC.'inc/parser/parser.php')) // newer than the parser && ($cachetime > @filemtime(DOKU_INC.'inc/parser/handler.php')))// newer than the handler { //well then use the cache $parsed = io_readfile($cache); $parsed .= "\n\n"; }else{ $parsed = p_render('xhtml', p_cached_instructions($masterFile),$info); //try to use cached instructions if($info['cache']){ io_saveFile($cache,$parsed); //save cachefile $parsed .= "\n\n"; }else{ @unlink($cache); //try to delete cachefile $parsed .= "\n\n"; } } return $parsed; } function html_sidebar() { global $ID; global $ACT; if ($ACT != 'show') return ''; // determine master sidebar file $masterFile = getSidebarFN(getNS($ID), 'sidebar'); // open sidebar
echo("