Essentially, the IR database is not downloaded to a LinuxMCE installation, in its entirety.
(when you see me talk camel case, I am talking about database tables)
/usr/pluto/bin/WebDB_GetIR.sh is used to grab the relevant PK_InfraRedGroup from the InfraredGroup table. This is linked to the DeviceTemplate (as a FK_InfraredGroup).
So basically, this script is asking my web server for a particular code group, and it comes back, and the relevant rows are altered in your database.
This is where things get a little murky...
We have a very cleverly designed system called sqlCVS, which loosely replicates a master database, amongst potentially tens of thousands of LinuxMCE users, this is done using the psc_* tables and columns in each table to implement a global primary key, which is carried across to multiple installations.
When you sqlcvs update, it checks your psc_* stuff, against the master server, to figure out (1) which rows have been deleted, (2) which rows have been added, and (3) which rows have been modified...and then executes a series of transcactions to get things in sync.
These psc_* numbers are used to figure out what the next primary key ID should be, when a new infra red group, device template #, whatever, is added...and since this database has had a LOT of modification, deletions, etc.. those primary key numbers have a big gap between the primary key, and what the global primary key is, (e.g. device templates right now, are somewhere around 2254, where the psc_id for that table is now in the 2400s, so new device templates will have a primary key # of 2401, UNTIL THEY ARE cHECKED IN, at which point, when they are approved, they get renumbered in the process, to 2255, or whatever... the same is for the IR groups...SOMETIMES THIS WORKS...SOMETIMES IT DOESN'T... this is why it is critical, if you're developing templates etc, t ALWAYS KEEP YOUR DATABASE IN SYNC, BEFORE YOU MAKE CHANGES, to try and mitigate these problems...
We really need database people to come in and try to improve this situation, it's a clever schema that was hoisted upon us by a mad scientist (Aaron Baalbergen, the guy who founded Pluto, and we've had to live with it, and while some of us understand the concepts very well, none of us have audited or tried to understand sqlCVS code to try and solve these problems.
I don't know if i've managed to explain anything, or if i've confused the shit out of you, but let me know.