[pmwiki-users] Global Expirediff
Patrick R. Michaud
pmichaud at pobox.com
Wed Apr 13 16:48:32 CDT 2005
On Wed, Apr 13, 2005 at 07:14:01PM +0200, Stefano wrote:
> How to expirediff for a group or the whole wiki all at once?
>
> DOn't tell me i habe to do one page bye one :(
You have to do it one page b... Oh, you said not to tell you that.
Okay, how about this:
if ($action=='expirediffall') {
Lock(2);
$page = RetrieveAuthPage($pagename, "admin");
if (!$page) { Abort("?admin password required"); }
$keepdays = @$_REQUEST['keepdays'];
$keepgmt = $Now - $keepdays * 86400;
$pagelist = $WikiDir->ls();
foreach($pagelist as $pagename) {
echo "$pagename\n";
$page = ReadPage($pagename);
$keys = array_keys($page);
foreach($keys as $k)
if (preg_match("/^\\w+:(\\d+)/", $k, $match))
if ($match[1] < $keepgmt) unset($page[$k]);
$WikiDir->delete($pagename);
WritePage($pagename, $page);
}
exit;
}
It's probably a good idea to make a backup copy of wiki.d/ before
doing this. :-)
Pm
More information about the pmwiki-users
mailing list