Trash

Summary: "safely delete" pages so that they can be restored and listed with pagelists
Version:
Prerequisites:
Status:
Maintainer: cda

Question

How can I "safely delete" pages and act as the OS "trash" or "recycle bin" ?

Answer

Copy trash.phpΔ to the cookbook directory and add

include_once("cookbook/trash.php");

to config.php.

Notes and Comments

The recipe adds two actions: 'trash' and 'untrash'.

MyGroup.MyPage?action=trash
       will "rename" MyGroup.MyPage to MyGroup.MyPage-trashed
MyGroup.MyPage-trashed?action=untrash
       will "rename" MyGroup.MyPage-untrash to MyGroup.MyPage

Pagelists can be used to view the pages that are trashed, and to present links to untrash them.

(:pagelist name=*-trashed:)

By default, the user is redirected to the (un)trashed page. Optionally, the redirect parameter can be used to specify another page:

MyGroup.MyPage?action=trash&redirect=Main.HomePage

See Also

DeleteAction

Contributors

Christophe David original script