[pmwiki-users] Periodically clear WikiSandbox?

Patrick R. Michaud pmichaud at pobox.com
Thu Feb 17 11:24:31 CST 2005


On Wed, Feb 16, 2005 at 10:14:39AM -0500, Dawn Green wrote:
> >However, I should probably (re-)publish my cookbook recipe that 
> >automatically clears the sandbox (or any other page) after N 
> >minutes of inactivity.
> 
> I think that that is a fantastic idea!  This exists already for v. 1?  
> Can the > recipe be configured to empty the sandbox when the browser closes?

The recipe I just published is v2 specific, but it can also be done
in v1.  For v1 the code would look something like:

    $AutoRestoreDir = 'wikirev.d';
    array_splice($WikiLibDirs, 1, 0, array($AutoRestoreDir));

    if (file_exists("$AutoRestoreDir/$pagename") &&
        file_exists("wiki.d/$pagename") &&
        $Now - filemtime("wiki.d/$pagename") > 900)
      rename("wiki.d/$pagename", "wiki.d/$pagename,$Now");

As with the v2 recipe, pages to be "auto restored" are placed into
the wikirev.d/ directory.  Any page that exists in wikirev.d/ is
automatically restored after 15 minutes (900 seconds) of inactivity.

Pm



More information about the pmwiki-users mailing list