Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

AutoRestore

Summary: Automatically restore pages after a set time interval
Version: 2007-02-15
Prerequisites:
Status: Stable
Maintainer: Pm
Categories: Administration

Questions answered by this recipe

How can I get PmWiki to automatically restore a page (e.g., the Main.WikiSandbox) after a set period of time?

Description

The autorestore.phpΔ script provides a mechanism to have select pages be automatically restored to known content after a set period of inactivity on the page.

Sometimes it is useful to have certain "sandbox" pages where authors can edit the page for experimenting and testing, but have the page revert back to a known version when the edits are finished. This recipe allows an administrator to select pages to be automatically restored in such a fashion.

Simply download autorestore.phpΔ and place it in the site's cookbook/ directory, and add the following lines to a local customization file.

    $AutoRestoreKeep = 900;            # keep edits for 15 minutes (900 seconds)
    include_once('cookbook/autorestore.php');

Next, manually create a directory called wikirev.d/ where the "known versions" of restored pages will be kept.

Now then, for any page that you want to have auto-restored, simply edit the page to contain the text you'd like to have restored, then copy that page's file from wiki.d/ into the wikirev.d/ directory you just created.

With this script enabled, any page copied into the wikirev.d/ directory will be automatically restored to that copy if more than $AutoRestoreKeep seconds have elapsed since the last edit of that page.

Notes

The AutoRestore script has been enabled on pmwiki.org for the Main.WikiSandbox page, which is automatically cleared after fifteen minutes of inactivity.

Pages will be restored the first time someone accesses the page directly after the timeout. Be aware that a side effect of this is that the old page contents will still be available for indirect accesses until someone accesses the page directly. Indirect accesses include accessing the page with an include or through a search (pagelist) and by accessing the page's content with the {Page$:var} markup.


Question

How can I get PmWiki to delete files, which were uploaded for pages or groups and which were automatically restored? How can I get PmWiki to restore at a certain time or at a manual configurable time?


Ok, so here's a new question. How can I get one page or group to autorestore at a different time interval? So, for example, I would have my wikisandbox page autorestore every 10 minutes, but my Main group autorestore every 2 minutes and my page on Example/Test autorestore every 15 secs?

Sorry, I hope this isn't too complicated.

Real Chris November 04, 2008, at 03:30 AM

use local customization files to set $AutoRestoreKeep. - HansB


Contributors

  • Pm, 2005-02-17
Edit - History - Print - Recent Changes - Search
Page last modified on November 04, 2008, at 05:00 AM