[pmwiki-users] Elegant perpage summary log?
Johnny Ernst Nielsen
j_e_n_pub at yahoo.dk
Sun Oct 14 02:03:42 CDT 2007
Greetings.
Is there a more elegant way to do this, than what I have done in my
local/config.php?
Is there a way to minimise disk reading?
---
function PerPageSummaryLog($pagename, &$page, &$new)
{
// No summary logs for log pages.
if (!strpos($pagename, "SummaryLog")
&& !strpos($pagename, "RecentChanges"))
{
// If the page has no configuration file.
if(!file_exists($LocalDir . $pagename . ".php"))
{
// Write configuration file.
$file = fopen($LocalDir . $pagename . ".php", "w");
fwrite($file, $newfileconfig);
fclose($file);
}
// If the page already has a configuration file.
else
{
// Make sure we don't clobber an already existing log setting
for the page.
$file = fopen($LocalDir . $pagename . ".php", "r");
$configfile = fread($file, filesize($LocalDir .
$pagename . ".php"));
fclose($file);
if(!strpos($configfile, "RecentChangesFmt['" .
$pagename . "SummaryLog']"))
{
$file = fopen($LocalDir . $pagename . ".php", "a");
fwrite($file, $appendfileconfig);
fclose($file);
}
}
}
}
array_unshift($EditFunctions, 'PerPageSummaryLog');
Best regards :o)
Johnny :o)
More information about the pmwiki-users
mailing list