Changeset 1320

Show
Ignore:
Timestamp:
09/02/08 14:36:56 (3 months ago)
Author:
_ck_
Message:

1.6.2 use cached data when possible to remove/reduce mysql queries

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-topic-views/trunk/bb-topic-views.php

    r1316 r1320  
    66Author: Mike Wittmann, _ck_ 
    77Author URI: http://blog.wittmania.com/ 
    8 Version: 1.6.1 
     8Version: 1.6.2 
    99*/ 
    1010 
     
    6262         
    6363function get_view_count ( $topic_id ) { 
    64         global $bbdb; 
     64        global $bbdb, $topic; 
     65         
     66        if (isset($topic->views) && $topic->topic_id===$topic_id) {return $topic->views;}       // bypass db for cached data 
    6567         
    6668        if (bb_get_option('bb_db_version')>1600) {      // bbPress 1.0 
     
    7476        } 
    7577                 
    76                //If it already set, it just returns the value 
     78        //If it already set, it just returns the value 
    7779 
    7880        if ($view_count<=0) { //If the view count hasn't bee initialized yet, this will initialize the value before it is returned