I imagine it's slow because it's frequently pulling a ton of data from the armory. I've tried adjusting the TTL values in CacheControl.class.php, making them all 86400, but my roster page still seems to load slowly every hour.
Am I doing something wrong in my code, is there some other thing I can change?
Here's the code for my roster page, minus my nasty CSS.
debug('emblem',TRUE)
// Enable this is if toons with special characters break the API.
// $armory->UTF8(TRUE);
// Set the locale. Will default back to region default if not defined. English normally.
// us.battle.net: en_US, es_MX
// eu.battle.net: en_GB, es_ES, fr_FR, ru_RU, de_DE
// kr.battle.net: ko_KR
// tw.battle.net: zh_TW
// battlenet.com.cn: zh_CN
$armory->setLocale('en_US');
// To reset back to default server locale
//$armory->setLocale(FALSE);
// To exclude some fields from characters to load.
$armory->characterExcludeFields(array('achievements','quests'));
// To reset the exclude list to not exclude anymore
//$armory->characterExcludeFields(FALSE);
// Load all the guild data into an object. This is NOT an array
$guild = $armory->getGuild('Shattered Oath');
// Adding guild rank names to all members.
// Supply a valid array starting with key 0. Remember to add enough ranks.
$approvedRanks = array(0, 1, 3, 7); // Sets the ranks displayed in the raid roster.
$guild_ranks = array(0=>'Bowser',
1=>'Magikoopa',
2=>'Hammer Brother',
3=>'Koopa Troopa',
4=>'Boo',
5=>'Yoshi!',
6=>'Goomba',
7=>'Bob-omb',
8=>'Chain Chomp'
);
$guild->setGuildRankTitles($guild_ranks);
$class_names = array(1=>'Warrior',
2=>'Paladin',
3=>'Hunter',
4=>'Rogue',
5=>'Priest',
6=>'Death Knight',
7=>'Shaman',
8=>'Mage',
9=>'Warlock',
10=>'Monk',
11=>'Druid'
);
// Get an array with all members and basic information sorted
// sort can be name|class|race|gender|level|rank
// sortflag can be asc | desc
$members = $guild->getMembers('rank','asc');
foreach($members as $member):
if ( ! in_array($member['rank'], $approvedRanks) ) continue;
// Get the character object. Will return FALSE if the
// character could not be found or character is frozen.
$name = $member['character']['name'];
$character = $armory->getCharacter($name);
// Return character news feed. New bosses killed, new items won, etc.
$feed = $character->getFeed();
// Return the amount of achievement points for the loaded character
$achievementpoints = $character->getAchievementPoints();
// Get active talent tree
$activetalents = $character->getActiveTalents();
// Return an array with equipped gear and itemlevel stats.
$gear = $character->getGear();
// Returns the complete URL for a character inset image
$profileinseturl = $character->getProfileInsetURL();
?>
I resolved this problem, the TTL values that needed to be changed were in BattlenetArmory.class.php, then I created a CRON job to get the page once a day.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a roster page on my guild's website. It's working fine, but it loads very slowly. It's currently up at: http://199.168.190.18/~shattere/roster.php
I imagine it's slow because it's frequently pulling a ton of data from the armory. I've tried adjusting the TTL values in CacheControl.class.php, making them all 86400, but my roster page still seems to load slowly every hour.
Am I doing something wrong in my code, is there some other thing I can change?
Here's the code for my roster page, minus my nasty CSS.
debug('emblem',TRUE) // Enable this is if toons with special characters break the API. // $armory->UTF8(TRUE); // Set the locale. Will default back to region default if not defined. English normally. // us.battle.net: en_US, es_MX // eu.battle.net: en_GB, es_ES, fr_FR, ru_RU, de_DE // kr.battle.net: ko_KR // tw.battle.net: zh_TW // battlenet.com.cn: zh_CN $armory->setLocale('en_US'); // To reset back to default server locale //$armory->setLocale(FALSE); // To exclude some fields from characters to load. $armory->characterExcludeFields(array('achievements','quests')); // To reset the exclude list to not exclude anymore //$armory->characterExcludeFields(FALSE); // Load all the guild data into an object. This is NOT an array $guild = $armory->getGuild('Shattered Oath'); // Adding guild rank names to all members. // Supply a valid array starting with key 0. Remember to add enough ranks. $approvedRanks = array(0, 1, 3, 7); // Sets the ranks displayed in the raid roster. $guild_ranks = array(0=>'Bowser', 1=>'Magikoopa', 2=>'Hammer Brother', 3=>'Koopa Troopa', 4=>'Boo', 5=>'Yoshi!', 6=>'Goomba', 7=>'Bob-omb', 8=>'Chain Chomp' ); $guild->setGuildRankTitles($guild_ranks); $class_names = array(1=>'Warrior', 2=>'Paladin', 3=>'Hunter', 4=>'Rogue', 5=>'Priest', 6=>'Death Knight', 7=>'Shaman', 8=>'Mage', 9=>'Warlock', 10=>'Monk', 11=>'Druid' ); // Get an array with all members and basic information sorted // sort can be name|class|race|gender|level|rank // sortflag can be asc | desc $members = $guild->getMembers('rank','asc'); foreach($members as $member): if ( ! in_array($member['rank'], $approvedRanks) ) continue; // Get the character object. Will return FALSE if the // character could not be found or character is frozen. $name = $member['character']['name']; $character = $armory->getCharacter($name); // Return character news feed. New bosses killed, new items won, etc. $feed = $character->getFeed(); // Return the amount of achievement points for the loaded character $achievementpoints = $character->getAchievementPoints(); // Get active talent tree $activetalents = $character->getActiveTalents(); // Return an array with equipped gear and itemlevel stats. $gear = $character->getGear(); // Returns the complete URL for a character inset image $profileinseturl = $character->getProfileInsetURL(); ?>I resolved this problem, the TTL values that needed to be changed were in BattlenetArmory.class.php, then I created a CRON job to get the page once a day.