RecentUploadsLog-Archive

Summary: Archive for the recipe RecentUploadsLog
Maintainer: Petko
Categories: Obsolete
License: GPL2+

This is an archived page. Before PmWiki 2.2.6, this recipe provided a RecentUploads functionality. From PmWiki version 2.2.6 and newer, this feature exists in the core, so the recipe is no longer needed. See RecentUploadsLog for more information.

Questions answered by this recipe

How do I track every uploaded file in the RecentChanges and AllRecentChanges pages and easily review it?

Description

Every uploaded file is logged in the Group.RecentUploads pages with a link from (All)RecentChanges for easy review.

To install this recipe:

  • download recentuploads.phpΔ
  • copy it to your cookbook directory
  • add in your config.php or farmconfig.php this line:
    if(@$_REQUEST['action'] == 'postupload') { include_once("$FarmD/cookbook/recentuploads.php");}

The format logged in the (All)RecentChanges pages is as follows:

  • Group.RecentUploads . . . 2007-02-17 11:12:18 Petko : Page/Picture.png (123456 bytes)
  • Group2.RecentUploads . . . 2007-02-17 10:32:58 Petko : Page2/Picture2.png (6543 bytes)

where Page is a link to the wiki page where the file was attached, and Picture.png is a link to the file itself (click to download/review it).

Only the latest upload for a Group is displayed in RecentChanges, however, clicking on the link Group.RecentUploads will show you all uploaded files for the Group.

In a new special page RecentUploads (you can go there from the link at the RecentChanges page) are stored logs for all uploaded attachments in the format:

  • Page/Picture.png . . . 2007-02-17 11:12:18 by Petko (123456 bytes)
  • Page/Dissertation.odt . . . 2007-02-17 10:33:55 by Petko (77500 bytes)

Changing the default logging format

(For advanced administrators.)

The default format is:

$RecentUploadsFmt['$SiteGroup.AllRecentChanges'] =
  '* [[{$Group}.RecentUploads]]  . . . $CurrentTime $AuthorLink :'
  .' [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]] ($upsize)';
$RecentUploadsFmt['$Group.RecentChanges'] =
  '* [[{$Group}/RecentUploads]]  . . . $CurrentTime $AuthorLink :'
  .' [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]] ($upsize)';
$RecentUploadsFmt['$Group.RecentUploads'] =
  '* [[{$Group}/{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]]'
  .'  . . . $CurrentTime $[by] $AuthorLink ($upsize)';

To unset one of the three default pages, where information is logged, set the following in config.php after the include_once() call.

To log nothing on Site.AllRecentChanges:

 unset($RecentUploadsFmt['$SiteGroup.AllRecentChanges']);

To log nothing on Group.RecentChanges:

 unset($RecentUploadsFmt['$Group.RecentChanges']);

Notes

  • The script will intercept a call to the $UploadVerifyFunction and if this function does not return an error, it will log the new file. This is done after a successfull upload to the server and all diskspace and filetype checks but before the actual moving of the file from the temporary directory to the upload wiki-directory and if eventually the "move" fails, in the RecentChanges there will be an attach:link to the non-existent file (you can click to re-upload it).
  • Naturally, only files uploaded after the installation of this recipe will be logged.

Release Notes

2007-03-12
changed the $RecentUploadFmt for a strategically better setting by default.
2007-02-17a
added the file size
2007-02-17
initial release

Comments

Changing the name of this recipe means the SiteAnalyzer cannot compare versions

You may also want to add a link to your RecentUploads pages from action=upload pages by adding something like the following near the top of your Site.UploadQuickReference page: --Eemeli Aro April 18, 2009, at 07:41 AM

(:if exists {*$Group}.RecentUploads:)
View log of [[{*$Group}.RecentUploads|recent uploads]] to this group
(:ifend:)

Questions

Is there, or is it possible to create, a Site.AllRecentUploads analagous to the Site.AllRecentChanges page.?

Sure, you can add to config.php the code:
 $RecentUploadsFmt['$SiteGroup.AllRecentUploads'] =
  '* [[{$Group}.{$Name}]]/[[(Attach:{$Group}.{$Name}/)$upname]]'
  .'  . . . $CurrentTime $[by] $AuthorLink ($upsize)';
It will list every upload to Site.AllRecentUploads. --Petko August 21, 2008, at 05:18 AM

See Also

Contributors