Tags:
create new tag
, view all tags

CounterPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on CounterPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Discussion Topic for the CounterPlugin

-- RahulMundke

The FILEPATH setting can be a big security hole and can compromise the system. For example, if someone sets it to /etc/passwd it would overwrite the passwd file.

It is safer to hide the storage location from the user. See related RecommendedStorageOfPluginData. You could store the counter files in the Plugin's attachment directory with name _Web_TopicName.txt, e.g. _Main_GuestBook.txt for the GuestBook topic in the Main web.

-- PeterThoeny - 21 Nov 2003

In order to make it work in my setup, I had to change _handleTag() in CounterPlugin.pm and substitute the absolute pathname with $FileLocation in all open() calls.

-- EnricoSpinielli - 21 Apr 2004

AaronDay has updated this and has changes that allow you to separate counting from tallying.

-- MartinCleaver - 15 May 2004

I downloaded this plugin with the expectation that it would work, however I came up with a few errors. For my solution all I wished to do was to count hits to TWiki > Main > WebHome , basically to count the hits to the front of the TWiki site.

I modified the perl (Without knowing any perl myself) so that now you are able to add %COUNTER_PLUGIN_INCREASE% to the page on which you wish to count the hits of. I then also allow the use of %COUNTER_PLUGIN_DISPLAY%, which reads the hitnumber and displays it to the page. It is not the best solution but it fits my required solution.

Hopefully someone can take this further and perhaps have a counter for each web topic as MartinCleaver and I discussed on IRC.

Many thanks for your help MartinCleaver.

-- AaronDay - 15 May 2004

I forgot to add that directories for the counter data are hard coded in the perl module, this of course would have to be changed to be dynamic with the above security concern taken into consideration.

-- AaronDay - 15 May 2004

checked .zip from CounterPlugin page into CVSplugins:CounterPlugin

-- WillNorris - 23 Nov 2004

Hi,

I tried the CounterPlugin version 15 May 2004 and experienced some problems:

  • This only has one counter file for the hole TWiki !?!

  • the counterfilename is fix /home/students/mtech03/rahulm/web/twiki/lib/TWiki/Plugins/datacount.txt

I added the following lines to CounterPlugin.pm:

   my $query = new CGI;
   my $thePathInfo = $query->path_info(); 
   $fileName = "/var/www/html/twiki/data/" . $thePathInfo . ".count";

   # untaint fileName
    if ($fileName =~ /^(.+)$/)
      {
             $fileName = $1;
          }
   if(!open(FILE , "< $fileName"))
     {
      # File doesnot exist
      $Count = 1;
       #die "Can't open datacount.txt file";
     }
   else
      {
      &TWiki::Func::writeDebug("Opened $fileName file successfully");
      $Count = <FILE>;
      close(FILE);
     }
        
   $str = $Count;
   
   open(FILE , "> $fileName") || die "Can't open \"$fileName\" file: $!";
   $Count = $Count + 1;
   print FILE $Count;
   close(FILE);
   
   return $str;

this adds a counter for each topic

If this is from interest, I could update the CounterPlugin.zip, or is this a new plugin? The functionality differs a bit, but this is like I think a counter should work...

-- MatthiasThullner - 04 Oct 2005

Matthias, the CVSModificationPolicy is set to PleaseFeelFreeToModify. So please go ahead and update the Plugin. See also ReadmeFirst.

-- PeterThoeny - 05 Oct 2005

uploaded a new zip in CounterPluginDev which creates a counter for each topic. Tested on Cairo

TODOs:

  • get path for topics automatically -> no changes on installation necessary
  • add possibility to substitute numbers by graphics

I did not manage to access http://svn.twiki.org:8181/svn/twiki/ frown

Host not found

did you change the URL? or is it possible it is locked by our firewall?

Complete Error message:

Error: PROPFIND request failed on '/svn/twiki'  
Error: PROPFIND of '/svn/twiki': Could not resolve hostname `svn.twiki.org': Der   
Error: angegebene Host ist unbekannt.   (http://svn.twiki.org:8181)  

-- MatthiasThullner - 05 Oct 2005

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip CounterPlugin.zip r1 manage 7.4 K 2005-10-05 - 08:30 MatthiasThullner creates a counter for each topic
Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2005-10-05 - MatthiasThullner
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.