Plugin Directory

Changeset 1416531


Ignore:
Timestamp:
05/13/2016 06:55:33 PM (10 years ago)
Author:
xnicoco
Message:

fixed seed/peer statistics

Location:
katracker/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • katracker/trunk/README.txt

    r1408047 r1416531  
    4747
    4848== Changelog ==
     49= 1.0.3 =
     50* Fixed seed/peer statistics
    4951
    5052= 1.0 =
  • katracker/trunk/functions.php

    r1407729 r1416531  
    124124 * @return int
    125125 */
    126 function get_torrent_seeders( $torrent_id=null ) {
     126function get_seeder_count( $torrent_id=null ) {
    127127    global $wpdb;
    128128    return $wpdb->get_var(
     
    142142 * @return int
    143143 */
    144 function get_torrent_leechers( $torrent_id=null ) {
     144function get_leecher_count( $torrent_id=null ) {
    145145    global $wpdb;
    146146    return $wpdb->get_var(
     
    166166                'leechers'  => get_torrent_meta( $torrent_id, 'leechers' ),
    167167            ) : array(
    168                 'seeders'   => get_torrent_seeders(),
    169                 'leechers'  => get_torrent_leechers(),
     168                'seeders'   => get_seeder_count(),
     169                'leechers'  => get_leecher_count(),
    170170            );
    171171}
  • katracker/trunk/katracker.php

    r1407738 r1416531  
    55 * Description: The only full and all powerful, complete bittorrent tracker integration for wordpress.
    66 * Author: nicoco
    7  * Version: 1.0.2
     7 * Version: 1.0.3
    88 * Author URI: kateam.org
    99 * License: GPL2
  • katracker/trunk/tracker/katracker.core.php

    r1407729 r1416531  
    256256        // fetch peer total
    257257        $total = $wpdb->get_var(
    258             // select a count of the number of peers that match the given info_hash
    259             "SELECT COUNT( * ) FROM `" . KATRACKER_DB_PREFIX . "peers` WHERE info_hash='{$_GET['info_hash']}'"
     258            // select a count of the number of peers
     259            "SELECT COUNT( * ) FROM `" . KATRACKER_DB_PREFIX . "peers` " .
     260            // that match the given info_hash
     261            "WHERE info_hash='{$_GET['info_hash']}'"
    260262        );
    261263
     
    393395    public static function flush_statistics()
    394396    {
     397        // if the torrent does not exists as file in wordpress db, do nothing.
    395398        if ( !$torrent_id = get_torrent_id_from_hash( $_GET['info_hash'] ) ) return;
    396399
    397         global $wpdb;
    398         $stats = get_torrent_stats( $torrent_id );
    399 
    400         update_torrent_meta( $torrent_id, 'seeders', $stats['seeders'] );
    401         update_torrent_meta( $torrent_id, 'leechers', $stats['leechers'] );
     400        update_torrent_meta( $torrent_id, 'seeders', get_seeder_count( $torrent_id ) );
     401        update_torrent_meta( $torrent_id, 'leechers', get_leecher_count( $torrent_id ) );
    402402    }
    403403
  • katracker/trunk/tracker/tracker-announce.php

    r1407729 r1416531  
    8383
    8484// Handle Request //////////////////////////////////////////////////////////////////////////////////
    85 // flush wordpress statistics
    86 KatrackerCore::flush_statistics();
    8785
    8886// check if the torrent is approved by the tracker
     
    9593KatrackerCore::event();
    9694
     95// flush wordpress statistics
     96KatrackerCore::flush_statistics();
    9797
    9898exit;
Note: See TracChangeset for help on using the changeset viewer.