Project

General

Profile

Actions

Feature proposal #2257

closed

Optimize number of queries made by Kunena for loading users

Added by beat about 13 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
29 January 2011
Due date:
% Done:

100%

Estimated time:
2:00 h

Description

This goes through implementing CBuser::advanceNoticeOfUsersNeeded( array $usersId )
and a new double-cache of userids and loading of multiple CBUser and moscomprofilerUser records.

Actions #1

Updated by beat about 13 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

r1371 implements this efficiently and in a backwards compatible way.

Usage:


if ( is_callable( array( 'CBuser', 'advanceNoticeOfUsersNeeded' ) ) {
CBuser::advanceNoticeOfUsersNeeded( array( 63, 64, 65 ) );
CBuser::advanceNoticeOfUsersNeeded( array( 66, 67, 65 ) );
}
echo CBuser::getUserDataInstance( 64 )->id;     // echo's 64
if ( is_callable( array( 'CBuser', 'advanceNoticeOfUsersNeeded' ) ) {
CBuser::advanceNoticeOfUsersNeeded( array( 68, 67, 69, 71 ) );
}
echo CBuser::getUserDataInstance( 67 )->id;     // echos 67
echo CBuser::getUserDataInstance( 69 )->username;    // echos username of user id 69

API:

/**
     * Sets an additional list of user records to also load and cache with next SQL query
     * e.g.:
     * CBuser::advanceNoticeOfUsersNeeded( array( 66, 67, 65 ) );        // just remembers
     * CBuser::advanceNoticeOfUsersNeeded( array( 64, 65 ) );            // just remembers
     * echo CBuser::getUserDataInstance( 64 )->id;        // echo's 64    // and loads 64-67
     * CBuser::advanceNoticeOfUsersNeeded( array( 68, 67, 69, 71 ) );    // just remembers
     * echo CBuser::getUserDataInstance( 67 )->id;        // echos 67        // and doesn't load
     * echo CBuser::getUserDataInstance( 69 )->username;    // echos    // and loads 68,69,71
     *
     * @param  array of int   $usersIds
     */
    public static function advanceNoticeOfUsersNeeded( $usersIds );
Actions #2

Updated by beat about 13 years ago

  • Status changed from Closed to Assigned
  • % Done changed from 100 to 90

Final Tests needed with latest dev build of k1.6.3

Actions #3

Updated by beat about 13 years ago

r1393 improved query in case userscount is one to use = instead of IN () for better query performance on older MySql versions

Actions #4

Updated by beat about 13 years ago

  • Status changed from Assigned to Closed

Tested, looks ok.

Actions #5

Updated by beat almost 9 years ago

  • % Done changed from 90 to 100
Actions

Also available in: Atom PDF