2008-08-28
ultraviolet
I've attached a .diff file for a quick patch against dokuwiki-2008-05-05. I need to know if I hit
the nail on the head or if the nail is in another wall.
Sorry to e-mail you all directly, but, I think I've discovered a tiny "bug", simple mistake.
I'd also like to know if this is _REAL_ or if I've misconfigured something else somewhere or something!
I'd have checked out the repo to see if you maybe fixed this already but no GHC and I'm too lazy to install.
While trying to get formula to work I noticed that NOCACHE wasn't working... Even though Ole Rienow's code
contains a specific call to turn off caching... I noticed that with both his code and NOCACHE enabled
even on pages that didn't have <FORM... but had NOCACHE... A cache file still appeared! There are only
two calls to $cache->storeCache($whatever)... One didn't check $info['cache'] properly _I THINK_.
My _TINY_ fix means Ole Rienow's plugin works without NOCACHE needing to be specified, the way intended!
BUT I CLEARLY have _ABSOLUTELY NO IDEA_ what I'm doing, so, please tell me if I'm right! Thanks!
Between line 600 and 700 in inc/parserutils.php there appears:
if ($cache->useCache()) {
$parsed = $cache->retrieveCache(false);
if($conf['allowdebug'] && $format=='xhtml') $parsed .= "\n<!-- cachefile {$cache->cache} used -->\n";
} else {
$parsed = p_render($format, p_cached_instructions($file,false,$id), $info);
// XXXXXXXXXXXXXXXXXXXXXXXXXXX NOTE: The Condition for $info['cache']...
if ($info['cache']) {
$cache->storeCache($parsed); //save cachefile
if($conf['allowdebug'] && $format=='xhtml') $parsed .= "\n<!-- no cachefile used, but created
+{$cache->cache} -->\n";
}else{
$cache->removeCache(); //try to delete cachefile
if($conf['allowdebug'] && $format=='xhtml') $parsed .= "\n<!-- no cachefile used, caching forbidden -->\n";
}
}
AND.... A little further along...
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));
// XXXXXXXXXXXXXXXXXXXXXXXXXXX NOTE: The cache file gets made without a condition... Rendering
// ~~NOCACHE~~ useless... UNLESS I'm mistaken.
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;
}