[pmwiki-users] Global Expirediff
Stefano
steagl at people.it
Thu Apr 14 03:36:20 CDT 2005
Il Wed, 13 Apr 2005 16:48:32 -0500, "Patrick R. Michaud"
<pmichaud at pobox.com> scrive:
>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. :-)
>
Thanks a lot :) You ar great! :)
--
Stefano Aglietti - StallonIt on IRCnet - ICQ#: 2078431
Email: steagl at people.it - steagl at despammed.com
BlogPage: http://www.40annibuttati.it/
PGP keys available on keyservers (cripted & signed PGP mail welcome)
More information about the pmwiki-users
mailing list