Well, I'm not very savvy when it comes to reading through PHP and figuring out what the code is doing, so I may be very wrong in how I'm interpreting this, but here is what I did:
All of this is from index.php
- Code: Select all
for ($i=0; $i<=5; $i++)
{
$playername=$players[$i];
echo $playername;
synchPlayer(null, $playername);
}
A very simple FOR statement to limit the number of players it feeds into the synchplayer function.
Then I tried changed the SQL query to try and make it so that it only grabs those names that haven't been updated in the last 24 hours.
- Code: Select all
"WHERE members.level >= " . $addon_conf['ArmorySync']['MinLevel'] . " AND members.level <= " . $addon_conf['ArmorySync']['MaxLevel'] ." " .
"AND ( ISNULL(players.name) " .
"OR members.update_time <= DATE_SUB(NOW(), INTERVAL " . $addon_conf['ArmorySync']['SynchCutoffTime'] . " HOUR) ) " .
"ORDER BY members.update_time ASC";
The main change was changing the field from "players.dateupdatedutc" to "members.update_time", and to switch the order to ASC instead of DESC.
I was assuming that the function updates the "members.update_time" field when it synchs, but I could be wrong. Also, are the formats compatible, and did I code this right. I could be making the stupidest of errors, and not even know. Someone with more insight into the mod, and better PHP experience might be better to answer this.
EDIT: If anyone has ideas on how to improve or make this work, I will not be offended if you rip it all up. I'm very new to PHP and coding, so all hints and tips are appreciated.