DokuWiki entry: plugin:dlcount
Download and install the plugin using the Plugin Manager using the following URL. Refer to :Plugins on how to install plugins manually.
http://wiki.birth-online.de/_media/software/php/dlcount.tar.gzManual download:
The plugin registers hooks for some events. It creates the meta-files below data/meta/_media/ in the same way DokuWiki does create its meta-data for normal pages.
This event is triggered when someone downloads a file. First it is checked whether this is a real download or a browser fetching an embedded image. In the latter case, it does nothing.
If this is a real download, it calculates the path to the meta-file. E.g. if someone is downloading http://wiki.birth-online.de/_media/software/php/dlcount_2009-02-03.tar.bz2, the meta file would be:
data/meta/_media/software/php/dlcount_2009-02-03.tar.bz2.meta
This contains a serialized structure which currently only holds an array containing a dlcount key with the actual download count. Maybe later this holds a complete log of all downloads of the file or at least the last 10 IPs downloading it…
The download counter is incremented by 1 and the new data is serialized and written back to the meta file.
If the file doesn't exist, it is created.
This event is triggered when a page is displayed. The plugin then wanders all A (=anchor) elements of the page and checks them for the mediafile class which indicates that this link is pointing to a download. Then the path to the meta-file is calculated and the number of downloads read from it. (If this file doesn't exist, a count of “0” is assumed.) In the last step, the count is added after the anchor.
This event is triggered after a new file was uploaded to the media library. If you overwrite an already existing file, the download counts for this file get reset to 0 (because there's now a new file online).
This event is triggered upon deletion of a file from the media library. This will also delete the associated meta data.
Please report problems on the plugin page of the DokuWiki homepage.
useslashes and colons instead of slashesfalseuseslashes option, thanks to TMH