DeletePage

(redirected from Cookbook.DeleteAction)

Summary: Use a "delete" action and a separate password for deleting pages
Version: 20220507
Prerequisites: PmWiki 2.x
Status:
Maintainer: Petko (Original authors: Pm, Klonk)
License: GPL2+
Discussion: DeleteAction-Talk

Question answered by this recipe

How can I use a separate password for deleting pages?

Description / Usage

The deletepage.phpΔ script adds an "?action=delete" which can be used to password-protect the removal of pages from the wiki. In addition, the script disables PmWiki's default page deletion mechanism, although this can be restored.

Installation / configuration

Place deletepage.phpΔ in pmwiki/cookbook and add the following to local/config.php:

include_once("$FarmD/cookbook/deletepage.php");
## Uncomment to redirect to other page after deletion
# $DeleteRedirectPage = '{$Group}.HomePage';
# $DeleteRedirectPage = 'Main.HomePage';

Discussion

By default, pages in PmWiki can be deleted by editing the page and changing the contents to the single word "delete" (controlled by the $DeleteKeyPattern variable). The deletepage.phpΔ script changes this so that pages are deleted via a separate ?action=delete added to the end of the URL, which can have a separate password from editing and other operations.

Note that as with the default page deletion, the pages are not entirely removed from the site's wiki.d/ directory -- the page file is simply renamed to include a timestamp. This is to guard against accidental or malicious page deletions via the PmWiki interface. Deleted pages are not completely removed until a wiki administrator deletes them from the wiki.d directory.

The deletepage.phpΔ script is enabled at Test.DeletePage for those who wish to see its effects. (It's not enabled for testing on this page for somewhat obvious reasons. :-)

Change log / Release notes

  • 20220507 - add $DeleteRedirectPage format (by Petko)
  • 20050810 - set $DefaultPassword for this action, so it works now also with 2.0beta54 (by Klonk)
  • 20050121 - initial release (by Pm)

Contributors

Comments

See discussion at DeletePage-Talk

User notes? : 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.