DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dlcount

DLCount Plugin

Compatible with DokuWiki

2009-02-16, Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons

plugin Adds download counter to download links

Last updated on
2009-02-27
Provides
Admin, Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with counter, download

Info and Download

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 commit ae10f61 for the fix.

dma_kdma_k

2016-09-19 01:39

2014-09-18

1) For linux web-hosting is ok. Does not work for windows localhost:

  • rewriting option = (1)
  • dokuwiki?do=admin&page=dlcounterror: 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

Does not work for sites without url rewriting. Sites with no rewrite Option (0) DOES NOT WORK. Working for Dokuwiki (internal) rewriting option (2), and webserver rewriting option (1). –Mat Witts

Added Patches from Andreas and create a German Translation

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: Tokeek.de, please test and feedback to me.

2013-04-15

When pdf extension is registered in the mime.conf as:

pdf application/pdf

it must not be counted, it is embedded. Unfortunately the plugin still shows the size, the time and 0 downloads for Pdfs. The counter stays 0 of course. I think it is a bug - if the extension marked as embedded, plugin should not show this information at all… — BrakeFluid

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 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. :-)
2014-06-27 (William Yin)
If your site on Windows Server system, you must be corrected dlcount's code with follow:

In action.php function metaFnFromFullPath():

Original line:
$fn = str_replace($mediadir, '', $fullpath);


Corrected line:

$fn = str_replace('\\', '/', $mediadir);
$fn = str_replace($fn, '', $fullpath);

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

plugin/dlcount.txt · Last modified: 2016-09-19 01:44 by dma_k