RecentChangesDeletion

Summary: Allow authors to delete RecentChanges pages, there-by making it possible for authors to delete wiki groups.
Version: 2023-09-03
Prerequisites:
Status:
Maintainer: Petko
License: PD

Questions answered by this recipe

How can a wiki group be deleted from within the wiki, given that normally any edit to any page in the group will be reported on the group's RecentChanges page, which will automatically be (re-)created for that purpose if necessary?

How can a wiki group's Group.RecentChanges page be deleted from within the wiki?

Description

For each wiki group "Group", there is the special page Group.RecentChanges that exists and cannot be deleted. Any effort to delete the page from within the wiki (by editing the page to "delete" or whatever the group's deletion code may be) will simply cause the wiki to update the group's Group.RecentChanges page itself. Normally, an administrator with server access will need to remove this Group.RecentChanges file from the wiki.d directory.

As an alternative, you can set this code in local/config.php (placing it toward the end, after any included core script or recipe). This will allow authors to delete the page via the normal in-wiki method for page-deletion:

SDV($DeleteKeyPattern,"^\\s*delete\\s*$");
if(preg_match("/$DeleteKeyPattern/", strval(@$_POST['text']))
  && PageVar($pagename, '$Name')=='RecentChanges')
    unset($RecentChangesFmt['$Group.RecentChanges']);

This code disables the logging of a deleted *.RecentChanges page on that same page. The deletion will still be logged on the page Site.AllRecentChanges.

Notes

Release Note

  • Added a fix for PHP 8.2+ -- Dfaure

See Also

Contributors

Comments

Disabling the log for deleted *.RecentChanges pages may be not what you want on a wiki that is open to editing by the general public.

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