Recent Changes - Search:




Summary: Automatically restore pages after a set time interval
Version: 2007-02-15
Status: Stable
Maintainer: Pm
Discussion: AutoRestore-Talk
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?


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)

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.


The AutoRestore script has been enabled on 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.

See also

Cookbook /
SessionPageStore  Temporary/Ephemeral page storage for testing purposes (Experimental)


  • Pm, 2005-02-17


See discussion at AutoRestore-Talk

User notes +4: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on January 26, 2016, at 07:45 PM