[pmwiki-users] How can I make an uploaded file expire?

Neil Herber (nospam) nospam at eton.ca
Fri Jan 23 06:33:59 CST 2009

On 2009-01-23 3:30 AM, Eemeli Aro wrote:
> 2009/1/23 Neil Herber (nospam) <nospam at eton.ca>:
>> I want to have an uploaded file available for a limited amount of time.
>> I would like it to be deleted (or unavailable for download) after a
>> certain date.
>> If I protected the group where the download lived and had an
>> authorization group (@limited) controlling access to the pages, could I
>> make the "@limited" authorization group *automatically* disappear after
>> a certain date?
>> Alternatively, how can I delete a set of pages automatically on a given
>> date?
>> One crude method I thought of was to set a very long $AutoRestoreKeep
>> value and have the wikirev.d/ "known version" of the page(s) be blank.
>> Or I suppose it could say "This page has expired..."
>> Any more elegant solution would be welcome!
> If you don't set the read authorization for the page or group
> directly, you could add the following to your config file. $expires
> should be the time when you want to end access and GroupName & its
> length as you need them to be.
> if ( !strncasecmp( $pagename, 'GroupName', N ) {
>   $HandleAuth['download'] = 'download';
>   $DefaultPasswords['download'] =
>     ( $Now < $expires ) ? '@limited' : '@lock';
> }
> Note that by default uploads are stored per group but accessed per
> page, meaning that by default if a user has read access to any page in
> a group they can download any files from that group via that page. See
> <http://www.mail-archive.com/pmwiki-devel@pmichaud.com/msg00878.html>
> for my suggested fix for this.
> eemeli

Thanks Eemeli

Your suggestion is appreciated, but it has the disadvantage (for me) of 
requiring access to the config files for each expiry. I really need a 
method that can be accomplished directly from wiki pages.

If that requires a one-time code addition to the config files, that's 
fine. For example, if I had custom markup that could parse:
(:page_expire 2009-01-29:) I would be all set.

Neil Herber

More information about the pmwiki-users mailing list