Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

2.1 View count won't increament.

13567

Comments

  • I take back what I said about a challenge. Uh, step one: disable the incrementview plugin - I hope that means if you have it or if it's enabled. I don't have it.

  • yes. if you don't see the increment plugin in your dashboard - that would be "disabled" :)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Actually, I don't have anything in my config file that's listed in steps 1 - 4. I'll await further advice before implementing the changes in step 5.

  • peregrineperegrine MVP
    edited May 2014

    that's strange - because if you don't have
    $Configuration['Vanilla']['Views']['Denormalize'] = TRUE;
    in your config views should automatically increment by 1.

    you might as well try step 5. if that doesn't work.

    we could debug further or you could just use the incrementviews plugin.

    out of curiousity did you, indeed try the statsbox plugin first.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I did try statsbox first and it displayed the boxes but views were still 1. I don't have 'Vanilla.Views.Denormalize' (or Vanilla.Views.Anything) in config.php.

    No need to debug further. I'm not that concerned. I joined the discussion to let @chanh know I was having the same issue. I may actually just take it off the display - hate the "1 View" staring me in the face.

    But thanks again for trying!

  • peregrineperegrine MVP
    edited May 2014

    and you tried step 5 or not, just for info purposes.

    you could just use the incrementviews plugin.

    http://vanillaforums.org/addon/incrementview-plugin

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Yes, may do that. I was just looking it up :-)

  • peregrineperegrine MVP
    edited May 2014

    are you using any caching, what OS are you using and are you using sql strict mode.

    you can find this out with phpinfo or http://vanillaforums.org/addon/versioncheck-plugin

    and do you have vanilla statistics enabled or not.

    when the thrill of the chase is gone and you are listing...

    http://www.goodreads.com/work/quotes/175720-zen-and-the-art-of-motorcycle-maintenance-an-inquiry-into-values?page=1

    http://en.wikipedia.org/wiki/Zen_and_the_Art_of_Motorcycle_Maintenance

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • OK, not sure if this is the info you're asking for:

    session.cache_limiter nocache nocache
    System Linux
    sql strict mode ?? I didn't see anything about that.

    Vanilla stats plugin is enabled

    Vanilla is on my friends site which is hosted through droa.com

    Trouble is, I should just leave well enough alone.

    Zen and the Art... was popular when I was in university and I kind of remember starting it, or maybe just thinking I should read it. But, I never did. It might be time to rethink that.

  • Also, Zen... was published 40 years ago. Robert Pirsig's site: http://www.robertpirsig.org/ looks like it was also created in 1974 - a few blink tags and I'd be right there.

  • @peregrine‌ I just added display: none to the ViewCount class in my theme. I'm not bothered about whether it's working. I guess I'm just zen about it. But thanks for you help!

  • chanhchanh OngETC.com - CMS Researcher ✭✭

    I just go through all steps and I am sorry to say that it does not solve the problem.

  • peregrineperegrine MVP
    edited May 2014

    @chanh said:
    I just go through all steps and I am sorry to say that it does not solve the problem.

    if you want to pursue it and do it, while were online now. I can try to help.

    it is up to you.

    add this to your config.php

    $Configuration['Garden']['Errors']['LogEnabled'] = TRUE;
    $Configuration['Garden']['Errors']['LogFile'] = 'log/DebugLog';

    if your forum is in the "vanilla" directory.

    create a folder called log (give it permissions 777)

    e.g.

    vanilla/log

    if your forum is in forum the folder would be in forum

    e.g. forum/log

    all of your debug messages will go to a file called DebugLog

    which you can view.


    then go into

    in /applications/vanilla/models/discussionmodel.php
    around line 1837

    temporarily replace the entire AddView function with code below

     public function AddView($DiscussionID) {
        $IncrementBy = 0;
        if (
        C('Vanilla.Views.Denormalize', FALSE) &&
        Gdn::Cache()->ActiveEnabled() &&
        Gdn::Cache()->Type() != Gdn_Cache::CACHE_TYPE_NULL)
        {
        $WritebackLimit = C('Vanilla.Views.DenormalizeWriteback', 10);
        $CacheKey = sprintf(DiscussionModel::CACHE_DISCUSSIONVIEWS, $DiscussionID);
        // Increment. If not success, create key.
        $Views = Gdn::Cache()->Increment($CacheKey);
         LogMessage(__FILE__,__LINE__,'Object','Method',"my views are $Views"); 
        if ($Views === Gdn_Cache::CACHEOP_FAILURE) {
        Gdn::Cache()->Store($CacheKey, 1);
       }  
      // Every X views, writeback to Discussions
         $tmp =  $Views % $WritebackLimit;
         LogMessage(__FILE__,__LINE__,'Object','Method',"my views writeback tmp is $Views  $WritebackLimit $tmp"); 
        if (($Views % $WritebackLimit) == 0) {
        $IncrementBy = floor($Views / $WritebackLimit) * $WritebackLimit;
        Gdn::Cache()->Decrement($CacheKey, $IncrementBy);
        }
        } else {
        $IncrementBy = 1;
        }
    
         // add these lines
      LogMessage(__FILE__,__LINE__,'Object','Method',"myincrement is: $IncrementBy");
        if ($IncrementBy) {
        $this->SQL
        ->Update('Discussion')
        ->Set('CountViews', "CountViews + {$IncrementBy}", FALSE)
        ->Where('DiscussionID', $DiscussionID)
        ->Put();
        }
        }
    

    then click on a discussion - and attach the results of your DebugLog

    post all of the following or I can't really help you solve.

    • 1 attach the results of your DebugLog
    • 2 also post your version of php and the OS that your web site is running on.
    • 3 post your config.php with passwords and other sensitive info removed.

    http://vanillaforums.org/discussion/25115/how-to-how-can-a-new-user-better-help-the-community-when-asking-a-question

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • chanhchanh OngETC.com - CMS Researcher ✭✭

    http://uhostetc.com/config.txt

    The log file has zero byte, I can't attach file so I post the url to the file.

  • peregrineperegrine MVP
    edited May 2014

    if it has zero byte then you haven't added the code I posted I believe.

    please attach a copy of the modified

    applications/vanilla/models/discussionmodel.php

    Do you by chance have a duplicate of it in the same folder with a similar name,
    if so move it somewhere else or rename the orignal to discussionmodel.ph without the p at the end.

    your Operating system is what version name and number. - there are lots of versions based off of Linux.

    e.g. Ubuntu 12.04 and the other 100+ types.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • I also suspect something is awry with your permissions if you have a DebugLog created and it is not written to.

    what are the permissions and ownership on DebugLog and
    what are the permissions and ownership on log folder

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • chanhchanh OngETC.com - CMS Researcher ✭✭

    I spent lot of time on this but getting no where. I even put a print "hello" to see something but nothing.

    I guess my question is when is this AddView function being call so I can click on the right place to at least see the "hello" or something more affirmative.

  • peregrineperegrine MVP
    edited May 2014

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • chanhchanh OngETC.com - CMS Researcher ✭✭

    I create DebugLog in cache folder thinking that it should be able to write to it but the file is still zero bytes.

    I found out from the support my OS is CentOS 5

    The strange thing about this is it works find on my test Windows server with MySql strict mode on so not sure what so special about my live share host site that cause this problem.

    I even use the autoinstaller that has the latest Vanilla 2.1 and still have the same problem.

  • peregrineperegrine MVP
    edited May 2014

    edited out. op decided not to pursue.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.