DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dlcount

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:dlcount [2014-09-18 22:06] – [2014-09-18] 46.247.219.74plugin:dlcount [2023-12-17 21:38] (current) – new download url Aleksandr
Line 1: Line 1:
-====== dlcount plugin ======+====== DLCount Plugin ======
  
 ---- plugin ---- ---- plugin ----
Line 7: Line 7:
 type       : Action Admin type       : Action Admin
 lastupdate : 2009-02-27 lastupdate : 2009-02-27
-compatible : 2009-02-16, Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons+compatible : Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons
 depends    :  depends    : 
 conflicts  conflicts 
Line 13: Line 13:
 tags       : counter download tags       : counter download
  
-downloadurl: http://wiki.birth-online.de/_media/software/php/dlcount.tar.gz+downloadurl: https://trello.com/1/cards/5af71e057c70015c350b2c3e/attachments/5af71e1fb3ee47040d8b7237/download/dlcount.zip 
 +bugtracker :  
 +sourcerepo :  
 +donationurl:  
 + 
 +screenshot_img: 
 ---- ----
  
-[[http://wiki.birth-online.de/software/php/dw-dlcount-plugin|Info and Download]]+===== How it works ===== 
 + 
 +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. 
 + 
 +==== MEDIA_SENDFILE ==== 
 + 
 +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. 
 + 
 +==== TPL_CONTENT_DISPLAY ==== 
 + 
 +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. 
 + 
 +==== MEDIA_UPLOAD_FINISH ==== 
 + 
 +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). 
 + 
 +==== MEDIA_DELETE_FILE ==== 
 + 
 +This event is triggered upon deletion of a file from the media library. This will also delete the associated meta data. 
  
 ===== Problems ===== ===== Problems =====
 +
 +==== 2016-09-19 ===
 +
 +I have noticed that plugin does not correctly treat media filenames when file encoding is UTF-8 (not URL-escaped). See [[https://github.com/dmak/dokuwiki/commit/ae10f61a2450ac8853907f2174f82f02222e7834|commit ae10f61]] for the fix.
 +
 + --- [[user>dma_k|dma_k]] //2016-09-19 01:39//
  
 ==== 2014-09-18 === ==== 2014-09-18 ===
-Does not work:+1) For linux web-hosting is ok. Does not work for windows localhost:
   * **rewriting option** = (1)   * **rewriting option** = (1)
-  * **error:** Warning: glob(): Pattern exceeds the maximum allowed length of 260 characters in D:\..\DokuWikiStick\dokuwiki\lib\plugins\dlcount\admin.php on line 48+  * ''dokuwiki?do=admin&page=dlcount'' => **error:** Warning: glob(): Pattern exceeds the maximum allowed length of 260 characters in D:\..\DokuWikiStick\dokuwiki\lib\plugins\dlcount\admin.php on line 48 
 + 
 +2) How to count link hits? 
 + 
  
 ==== 2014-04-30 === ==== 2014-04-30 ===
plugin/dlcount.1411070765.txt.gz · Last modified: 2014-09-18 22:06 by 46.247.219.74

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki