[Home]WikiPatches/PageDeletion

UseModWiki | WikiPatches | RecentChanges | Preferences

This feature has been added to 1.0, but it can be disabled in the configuration. --CliffordAdams

Could it be that the page deletion code does not delete pages that start with "DeletedPage:" -- note the colon. This is based on me running action=maintain and then searching for all DeletedPage pages... -- AlexSchroeder

The exact condition for deleting a page is (from the 0.99 final beta):

  if ($DeletedPage && $Text{'text'} =~ /^\s*$DeletedPage\W*?(\n|$)/o) {

...which allows only non-"word" (non-alphanumeric) characters on the same line as "DeletedPage". This means that any reasons for deleting a page should be placed on another line below the actual "DeletedPage" line. (The colon is OK, but the text after the colon stops the deletion.) --CliffordAdams


Implements MeatBall:PageDeletion. This allows any community member to delete a page with the caveat that any other community member may veto the change provided they action before the expiry time elapses. This assumes you've put action=maintain into a crontab somewhere.

ProcessVetos? will be upgraded later with more vetoable actions, like the ability to replace a file on disk (e.g. the wiki script).

As always, bold lines are changed lines.

NOTE: Page deletion is very dangerous. APPLY THIS PATCH AT YOUR OWN RISK. -- SunirShah

See also WikiPatches/FileReplacement


A malicious user can change the text of a page to "foo" and if this change is not reversed before the expiry time the page is deleted in practical terms. So your mod does not seem any more dangerous. In fact if it shows up explicitly as a delete in RecentChanges then it would be safer as it would be less likely to go unnoticed. I think I'd be more cautious about your /FileReplacement patch than this patch on its own.

So question: does it show up in RecentChanges? If not, how easy is it to make it so?

sub DeletePage has the option of removing the page from the rclog. I explicitly request this behaviour in the code below, but it's not hard to change this. However, I don't think it's a big deal. If people aren't looking at page changes anyway, then you're pretty much screwed even without PageDeletion? as you point out. An alternative would be to act like WikiWiki and put a (deleted) in the RecentChanges output in some way. --ss


 Add $DeletedPage to use vars qw()

 ...
 $EmbedWiki   = 0;               # 1 = no headers/footers, 0 = normal wiki page
 $DeletedPage = "DeletedPage";   # 0 = disable page deletion; "string" for page  deletion marker text
 ...

 # Actions are vetoable if someone edits the page before
 # the keep expiry time. For example, page deletion. If
 # no one edits the page by the time the keep expiry time
 # elapses, then no one has vetoed the last action, and the
 # action is accepted.
 # See http://meatballwiki.org/wiki/PageDeletion
 #
 # returns ' (deleted)' if the page has been deleted, 0 otherwise.
 sub ProcessVetos {
   my ($expirets);
   $expirets = $Now - ($KeepDays * 24 * 60 * 60);
   return 0 unless $Page{'ts'} < $expirets; 

   if( $DeletedPage && $Text{'text'} =~ /^\s*$DeletedPage\W*?(\n|$)/o )
   {
     &DeletePage($OpenPageName, 1, 1);
     return ' (deleted)';
   }

   return 0;
 }

 sub DoMaintain {
   ...
   &RequestLock() or die(T('Could not get maintain-lock'));
   foreach $name (&AllPagesList()) {
     &OpenPage($name);
     &OpenDefaultText();
     my $message = &ProcessVetos();
     &ExpireKeepFile() unless $message eq ' (deleted)';
     print ".... "  if ($name =~ m|/|);
     print &GetPageLink($name);
     print "$message<br>\n";
   }   
   ...
 }


NextRelease


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited November 6, 2023 9:02 pm by MarkusLude (diff)
Search: