DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:dlcount

This is an old revision of the document!


dlcount plugin

Compatible with DokuWiki

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

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

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. :-)

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.1397590561.txt.gz · Last modified: 2014-04-15 21:36 by 129.6.178.64

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