====== dlcount plugin ====== ---- plugin ---- description: Adds download counter to download links author : Markus Birth email : mbirth@webwriters.de type : Action Admin lastupdate : 2009-02-27 compatible : 2009-02-16, previous and newer depends : conflicts : similar : tags : counter download downloadurl: http://wiki.birth-online.de/_media/software/php/dlcount.tar.gz ---- [[http://wiki.birth-online.de/software/php/dw-dlcount-plugin|Info and Download]] ===== Problems ===== ==== Added Patches from Andreas and create a German Translation ==== [[th-suess@gmx.de|Thomas Süß]] 2010-02-09 Hello, I have installed the first two patches from Andreas, and a German translation created. Warning - this is not an official version. More information and Download at: [[http://tokeek.de/doku.php?id=wiki:dokuwiki-plugins|Tokeek.de]], please test and feedback to me. ==== 2010-01-13 ==== Any reason why in my DokuWiki installation (''2009-02-14'') the plugin just won't create the ''_media/*'' files? (thus reporting all my files as 0 downloads) -- --- //[[luis.machuca@gulix.cl|Luis]] 2010/01/13 21:27// > For me it was not counting pdf file. It always show 0. I am not expert so I found solution by hit and trial > > In Dokuwiki installation go to "conf/mime.conf" > open mime.conf in notepad > where it is written > > pdf application/pdf > > Replace it with > > pdf !application/pdf > > means just put ! sign before application. But be careful as I said I am not expert. Now it is counting pdf files for me. :-) ==== 2009-10-09 (Andreas Vogel) ==== I have found two things which didn't work for me and I suggest to fix this in the plugin as well. **1) In //admin.php// function //handle()//:** Original line: $this->mediafiles = $this->glob_recursive($conf['mediadir'] . '/*.*'); Corrected line: $this->mediafiles = $this->glob_recursive($conf['mediadir'] . '/*'); Without this modification no media files and directories are found at my site. **2) In //admin.php// function //handle()//:** Add this code directly after the "//foreach// ..." loop statement: if (is_dir($mediafile)) { unset($this->mediafiles[$idx]); continue; } Without this statement directories will be shown as downloadable files on the download statistic page. This doesn't make sense. **3) In //action.php// function //_showcount()//:** After the line $fn = substr($href, strpos($href, '/_media/')+strlen('/_media/')-1); add the line $fn = str_replace(':', '/', $fn); After rewriting the URL when using the mod_rewrite feature in .htaccess the colon needs to be replaced by a slash too - like in the other cases. ---- ==== 2009-08-09 ==== >Constants in objects start working with PHP 5. >One way is to update (that's the better way to go. php4 is out of support), the other is to go to line 16/17 in admin.php and action.php, delete them and put this above the class definition: > > define('dlcount_DATADIR','_media'); // below $conf['metadir'], no trailing slash define('dlcount_SUFFIX','.meta'); > >Then go throu the code and replace every self::DATADIR and self::SUFFIX with dlcount_DATADIR and dlcount_SUFFIX > > >After that it should work with PHP 4 > >---//bitcloud// ---- ==== 2009-04-15 ==== >after installation via plugin manager the following errors occurs: > > Parse error: syntax error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /dokuwiki/lib/plugins/dlcount/action.php on line 16 > >is there a solution for that? > >---//wekads// ---- ==== 2009-02-27 ==== > I still have a problem, even I use latest version. After 'media' colons in namespace are not replaced by backslashes. Should be fixed now. ---//mARKUS// ---- ==== 2009-02-27 ==== > Second problem...download statistic failed by next errors: > ... > I fix it by replacing of glob_recursive function by little different function instead: > function all_files($dir) { $files = Array(); $file_tmp= glob($dir.'*',GLOB_MARK | GLOB_NOSORT); foreach($file_tmp as $item){ if(substr($item,-1)!=DIRECTORY_SEPARATOR) $files[] = $item; else $files = array_merge($files,all_files($item)); } return $files; } >---//Geby// I changed ''glob_recursive()'' a bit ... please try the latest version. ---//mARKUS// It not produce errors now, but not working well. :( It's looks like no media files are on my server. I switch back to my previous modified routine and all is fine. ---//Geby//