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

Eemeli Aro eemeli at gmail.com
Fri Jan 23 02:30:15 CST 2009


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



More information about the pmwiki-users mailing list