root/dev/common/includes/autoupgrade.php @ 221

Revision 221, 23.9 KB (checked in by ralle030583, 15 years ago)

-navigation table now will be created during install
-default pages will be added to navigation table when other killboards use same db. (different KB_SITE's)

Line 
1<?php
2require_once("db.php");
3function check_commenttable()
4{
5    $qry = new DBQuery();
6    $query = 'select count(*) from kb3_comments';
7    $result = $qry->execute($query);
8    if ($result)
9    {
10        check_commenttablerow();
11        return;
12    }
13    $query = 'CREATE TABLE `kb3_comments` (
14        `ID` INT NOT NULL AUTO_INCREMENT ,
15        `kll_id` INT NOT NULL ,
16        `comment` TEXT NOT NULL ,
17        `name` TINYTEXT NOT NULL ,
18        `posttime` TIMESTAMP DEFAULT \'0000-00-00 00:00:00\' NOT NULL,
19        PRIMARY KEY ( `ID` )
20        ) TYPE = MYISAM';
21    $qry->execute($query);
22}
23
24function check_navigationtable(){
25        if (CORP_ID)
26        {
27            $statlink = '?a=corp_detail&crp_id='.CORP_ID;
28        }
29        elseif (ALLIANCE_ID)
30        {
31            $statlink = '?a=alliance_detail&all_id='.ALLIANCE_ID;
32        }
33        $qry = new DBQuery();
34        $query = 'select count(*) from kb3_navigation';
35        $result = mysql_query($query);
36        if ($result)
37        {
38                $query = "select count(KBSITE) from kb3_navigation WHERE KBSITE = '".KB_SITE."'";
39                $result = @mysql_query($query);
40                if ($result)
41                {
42                        $row = mysql_fetch_row($result);
43                        if ($row[0] == 0)
44                        {
45                                $queries = "INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Home','?a=home','_self',1,'ALL_PAGES','".KB_SITE."');
46                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Campaings','?a=campaigns','_self',2,'ALL_PAGES','".KB_SITE."');
47                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Contracts','?a=contracts','_self',3,'ALL_PAGES','".KB_SITE."');
48                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Kills','?a=home','_self',4,'ALL_PAGES','".KB_SITE."');
49                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Losses','?a=losses','_self',5,'ALL_PAGES','".KB_SITE."');
50                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Post Mail','?a=post','_self',6,'ALL_PAGES','".KB_SITE."');
51                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Stats','$statlink','_self',7,'ALL_PAGES','".KB_SITE."');
52                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Awards','?a=awards','_self',8,'ALL_PAGES','".KB_SITE."');
53                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Standings','?a=standings','_self',9,'ALL_PAGES','".KB_SITE."');
54                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Search','?a=search','_self',10,'ALL_PAGES','".KB_SITE."');
55                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'Admin','?a=admin','_self',11,'ALL_PAGES','".KB_SITE."');
56                                                        INSERT IGNORE INTO `kb3_navigation` (`nav_type`,`intern`,`descr` ,`url` ,`target`,`posnr` ,`page`,`KBSITE`) VALUES ('top',1,'About','?a=about','_self',12,'ALL_PAGES','".KB_SITE."');";
57                                $query = explode("\n", $queries);
58                                foreach ($query as $querystring)
59                                {
60                                        if ($string = trim(str_replace(');', ')', $querystring)))
61                                        {
62                                            $qry->execute($string);
63                                        }
64                                }
65                        }
66                        return;
67                }
68                $query = 'ALTER TABLE `kb3_navigation` ADD `KBSITE` VARCHAR( 16 ) NOT NULL';
69        $qry->execute($query);
70                $query = 'UPDATE `kb3_navigation` SET KBSITE = "'.KB_SITE.'" WHERE KBSITE LIKE "";';
71        $qry->execute($query);
72                return;
73        }
74        $query = 'CREATE TABLE `kb3_navigation` (
75        `ID` INT NOT NULL AUTO_INCREMENT ,
76        `nav_type` TINYTEXT NOT NULL,
77        `intern` INT ( 1 ) NOT NULL,
78        `descr` TINYTEXT NOT NULL ,
79        `url` TINYTEXT NOT NULL ,
80        `target` VARCHAR( 10 )  NOT NULL,
81        `posnr` INT NOT NULL,
82        `page` TINYTEXT NOT NULL,
83        `KBSITE` VARCHAR ( 16 ) NOT NULL,
84        PRIMARY KEY ( `ID` )
85        ) TYPE = MYISAM;';
86           $qry->execute($query);
87        $queries = "INSERT IGNORE INTO `kb3_navigation` VALUES (1,'top',1,'Home','?a=home','_self',1,'ALL_PAGES','".KB_SITE."');
88                INSERT IGNORE INTO `kb3_navigation` VALUES (2,'top',1,'Campaings','?a=campaigns','_self',2,'ALL_PAGES','".KB_SITE."');
89                INSERT IGNORE INTO `kb3_navigation` VALUES (3,'top',1,'Contracts','?a=contracts','_self',3,'ALL_PAGES','".KB_SITE."');
90                INSERT IGNORE INTO `kb3_navigation` VALUES (4,'top',1,'Kills','?a=home','_self',4,'ALL_PAGES','".KB_SITE."');
91                INSERT IGNORE INTO `kb3_navigation` VALUES (5,'top',1,'Losses','?a=losses','_self',5,'ALL_PAGES','".KB_SITE."');
92                INSERT IGNORE INTO `kb3_navigation` VALUES (6,'top',1,'Post Mail','?a=post','_self',6,'ALL_PAGES','".KB_SITE."');
93                INSERT IGNORE INTO `kb3_navigation` VALUES (7,'top',1,'Stats','$statlink','_self',7,'ALL_PAGES','".KB_SITE."');
94                INSERT IGNORE INTO `kb3_navigation` VALUES (8,'top',1,'Awards','?a=awards','_self',8,'ALL_PAGES','".KB_SITE."');
95                INSERT IGNORE INTO `kb3_navigation` VALUES (9,'top',1,'Standings','?a=standings','_self',9,'ALL_PAGES','".KB_SITE."');
96                INSERT IGNORE INTO `kb3_navigation` VALUES (10,'top',1,'Search','?a=search','_self',10,'ALL_PAGES','".KB_SITE."');
97                INSERT IGNORE INTO `kb3_navigation` VALUES (11,'top',1,'Admin','?a=admin','_self',11,'ALL_PAGES','".KB_SITE."');
98                INSERT IGNORE INTO `kb3_navigation` VALUES (12,'top',1,'About','?a=about','_self',12,'ALL_PAGES','".KB_SITE."');";
99        $query = explode("\n", $queries);
100        foreach ($query as $querystring)
101        {
102                if ($string = trim(str_replace(');', ')', $querystring)))
103                {
104                    $qry->execute($string);
105                }
106        }
107}       
108
109function check_commenttablerow()
110{
111    $qry = new DBQuery();
112    $query = 'select posttime from kb3_comments limit 1';
113    $result = mysql_query($query);
114    if ($result)
115    {
116        $query = 'ALTER TABLE `kb3_comments` CHANGE `ID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT';
117        $qry->execute($query);
118        return;
119    }
120    $query = 'ALTER TABLE `kb3_comments` ADD `posttime` TIMESTAMP DEFAULT \'0000-00-00 00:00:00\' NOT NULL';
121    $qry->execute($query);
122}
123
124function check_shipvaltable()
125{
126    $qry = new DBQuery();
127    $query = 'select count(*) from kb3_ships_values';
128    $result = mysql_query($query);
129    if ($result)
130    {
131        return;
132    }
133    $query = 'CREATE TABLE `kb3_ships_values` (
134`shp_id` INT( 11 ) NOT NULL ,
135`shp_value` BIGINT( 4 ) NOT NULL ,
136PRIMARY KEY ( `shp_id` )
137) TYPE = MYISAM ;';
138    $qry->execute($query);
139    $qry->execute('UPDATE kb3_ships set shp_class = 8 WHERE shp_id=257 limit 1');
140    $qry->execute('UPDATE kb3_ships set shp_class = 8 WHERE shp_id=252 limit 1');
141    $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=266 limit 1');
142    $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=275 limit 1');
143    $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=272 limit 1');
144    $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=246 limit 1');
145    $qry->execute('UPDATE kb3_ships set shp_class = 4 WHERE shp_id=249 limit 1');
146    $qry->execute('UPDATE kb3_ships set shp_techlevel = 2 where shp_class = 22');
147}
148
149function check_invdetail()
150{
151    $qry = new DBQuery();
152    $query = 'select ind_sec_status from kb3_inv_detail limit 1';
153    $qry->execute($query);
154    $len = mysql_field_len($qry->resid_,0);
155    if ($len == 4)
156    {
157        $query = 'ALTER TABLE `kb3_inv_detail` CHANGE `ind_sec_status` `ind_sec_status` VARCHAR(5)';
158        $qry->execute($query);
159    }
160}
161
162function check_pilots()
163{
164    $qry = new DBQuery();
165    $query = 'select plt_name from kb3_pilots limit 1';
166    $qry->execute($query);
167    $len = mysql_field_len($qry->resid_,0);
168    if ($len == 32)
169    {
170        $query = 'ALTER TABLE `kb3_pilots` CHANGE `plt_name` `plt_name` VARCHAR(64) NOT NULL';
171        $qry->execute($query);
172    }
173}
174
175function check_contracts()
176{
177    $qry = new DBQuery();
178    $query = 'select ctd_sys_id from kb3_contract_details limit 1';
179    $result = mysql_query($query);
180    if ($result)
181    {
182        return;
183    }
184    $qry->execute('ALTER TABLE `kb3_contract_details` ADD `ctd_sys_id` INT(11) NOT NULL DEFAULT \'0\'');
185
186    $qry->execute('SHOW columns from `kb3_contract_details` like \'ctd_ctr_id\'');
187    $arr = $qry->getRow();
188    if ($arr['Key'] == 'PRI')
189    {
190        return;
191    }
192    $qry->execute('ALTER TABLE `kb3_contract_details` ADD INDEX (`ctd_ctr_id`) ');
193}
194function check_index()
195{
196    check_index_invcrp();
197    check_index_invall();
198    $qry = new DBQuery();
199    $qry->execute('SHOW columns from kb3_item_types like \'itt_id\'');
200    $arr = $qry->getRow();
201    if ($arr['Key'] == 'PRI')
202    {
203        return;
204    }
205    $qry->execute('ALTER TABLE `kb3_item_types` ADD PRIMARY KEY ( `itt_id` ) ');
206}
207function check_index_invcrp()
208{
209    $qry = new DBQuery();
210    $qry->execute('SHOW columns from kb3_inv_crp like \'inc_kll_id\'');
211    $arr = $qry->getRow();
212    if ($arr['Key'] == 'MUL')
213    {
214        return;
215    }
216    $qry->execute('ALTER TABLE `kb3_inv_crp` ADD INDEX ( `inc_kll_id` ) ');
217}
218function check_index_invall()
219{
220    $qry = new DBQuery();
221    $qry->execute('SHOW columns from kb3_inv_all like \'ina_kll_id\'');
222    $arr = $qry->getRow();
223    if ($arr['Key'] == 'MUL')
224    {
225        return;
226    }
227    $qry->execute('ALTER TABLE `kb3_inv_all` ADD INDEX ( `ina_kll_id` ) ');
228}
229function check_tblstrct1()
230{
231    $qry = new DBQuery();
232    $query = 'select shp_description from kb3_ships limit 1';
233    $result = mysql_query($query);
234    if (!$result)
235    {
236        return;
237    }
238    $query = 'ALTER TABLE `kb3_ships` DROP `shp_description`';
239    $qry->execute($query);
240}
241function check_tblstrct2()
242{
243    $qry = new DBQuery();
244    $query = 'select itm_description from kb3_items limit 1';
245    $result = mysql_query($query);
246    if (!$result)
247    {
248        return;
249    }
250    $query = 'ALTER TABLE `kb3_items` DROP `itm_description`';
251    $qry->execute($query);
252}
253function check_tblstrct3()
254{
255    $qry = new DBQuery();
256    $query = 'select Value from kb3_items limit 1';
257    $result = mysql_query($query);
258    if ($result)
259    {
260        $query = 'ALTER TABLE `kb3_items` CHANGE `Value` `itm_value` INT( 11 ) NOT NULL DEFAULT \'0\'';
261        $qry->execute($query);
262    }
263}
264function check_tblstrct4()
265{
266    $qry = new DBQuery();
267    $query = 'select itm_value from kb3_items limit 1';
268    $result = mysql_query($query);
269    if ($result)
270    {
271        return;
272    }
273    $query = 'ALTER TABLE `kb3_items` ADD `itm_value` INT( 11 ) NOT NULL DEFAULT \'0\'';
274    $qry->execute($query);
275    $qry->execute('ALTER TABLE `kb3_items` CHANGE `itm_externalid` `itm_externalid` INT( 11 ) NOT NULL DEFAULT \'0\'');
276}
277
278function check_tblstrct5()
279{
280    $qry = new DBQuery();
281    $query = 'select count(*) from kb3_standings';
282    $result = mysql_query($query);
283    if ($result)
284    {
285        $query = 'select count(*) from kb3_standings where sta_from=1 and sta_to=1 and sta_from_type=\'a\' and
286                  sta_to_type=\'c\'';
287        $result = mysql_query($query);
288        if ($result)
289        {
290            return;
291        }
292        $qry->execute('drop table kb3_standings');
293    }
294$query = 'CREATE TABLE `kb3_standings` (
295  `sta_from` int(11) NOT NULL default \'0\',
296  `sta_to` int(11) NOT NULL default \'0\',
297  `sta_from_type` enum(\'a\',\'c\') NOT NULL default \'a\',
298  `sta_to_type` enum(\'a\',\'c\') NOT NULL default \'a\',
299  `sta_value` float NOT NULL default \'0\',
300  `sta_comment` varchar(200) NOT NULL,
301  KEY `sta_from` (`sta_from`)
302) TYPE=MyISAM;';
303    $qry->execute($query);
304}
305
306function chk_kb3_items()
307{
308    $qry = new DBQuery();
309    $query = 'select count(*) from kb3_item_types where itt_id = 787';
310    $result = mysql_query($query);
311    $result = mysql_fetch_array($result);
312    if ($result['cnt'] == 1)
313    {
314        return;
315    }
316    $queries = "
317        INSERT IGNORE INTO `kb3_item_types` VALUES (737, 'Gas Cloud Harvester',1);
318        INSERT IGNORE INTO `kb3_item_types` VALUES (762, 'Inertia Stabilizer',3);
319        INSERT IGNORE INTO `kb3_item_types` VALUES (763, 'Nanofiber Internal Structure',3);
320        INSERT IGNORE INTO `kb3_item_types` VALUES (764, 'Overdrive Injector System',3);
321        INSERT IGNORE INTO `kb3_item_types` VALUES (765, 'Expanded Cargohold',3);
322        INSERT IGNORE INTO `kb3_item_types` VALUES (766, 'Power Diagnostic System',3);
323        INSERT IGNORE INTO `kb3_item_types` VALUES (767, 'Capacitor Power Relay',3);
324        INSERT IGNORE INTO `kb3_item_types` VALUES (768, 'Capacitor Flux Coil',3);
325        INSERT IGNORE INTO `kb3_item_types` VALUES (769, 'Reactor Control Unit',3);
326        INSERT IGNORE INTO `kb3_item_types` VALUES (770, 'Shield Flux Coil',3);
327        INSERT IGNORE INTO `kb3_item_types` VALUES (771, 'Missile Launcher Heavy Assault',1);
328        INSERT IGNORE INTO `kb3_item_types` VALUES (738, 'Cyber Armor', 0);
329        INSERT IGNORE INTO `kb3_item_types` VALUES (740, 'Cyber Electronics', 0);
330        INSERT IGNORE INTO `kb3_item_types` VALUES (741, 'Cyber Engineering', 0);
331        INSERT IGNORE INTO `kb3_item_types` VALUES (742, 'Cyber Gunnery', 0);
332        INSERT IGNORE INTO `kb3_item_types` VALUES (743, 'Cyber Industry', 0);
333        INSERT IGNORE INTO `kb3_item_types` VALUES (744, 'Cyber Leadership', 0);
334        INSERT IGNORE INTO `kb3_item_types` VALUES (745, 'Cyber Learning', 0);
335        INSERT IGNORE INTO `kb3_item_types` VALUES (746, 'Cyber Missile', 0);
336        INSERT IGNORE INTO `kb3_item_types` VALUES (747, 'Cyber Navigation', 0);
337        INSERT IGNORE INTO `kb3_item_types` VALUES (748, 'Cyber Science', 0);
338        INSERT IGNORE INTO `kb3_item_types` VALUES (749, 'Cyber Shields', 0);
339        INSERT IGNORE INTO `kb3_item_types` VALUES (772, 'Assault Missile', 0);
340        INSERT IGNORE INTO `kb3_item_types` VALUES (773, 'Rig Armor', 5);
341        INSERT IGNORE INTO `kb3_item_types` VALUES (774, 'Rig Shield', 5);
342        INSERT IGNORE INTO `kb3_item_types` VALUES (775, 'Rig Energy Weapon', 5);
343        INSERT IGNORE INTO `kb3_item_types` VALUES (776, 'Rig Hybrid Weapon', 5);
344        INSERT IGNORE INTO `kb3_item_types` VALUES (777, 'Rig Projectile Weapon', 5);
345        INSERT IGNORE INTO `kb3_item_types` VALUES (778, 'Rig Drones', 5);
346        INSERT IGNORE INTO `kb3_item_types` VALUES (779, 'Rig Launcher', 5);
347        INSERT IGNORE INTO `kb3_item_types` VALUES (780, 'Rig Electronics', 5);
348        INSERT IGNORE INTO `kb3_item_types` VALUES (781, 'Rig Energy Grid', 5);
349        INSERT IGNORE INTO `kb3_item_types` VALUES (782, 'Rig Astronautic', 5);
350        INSERT IGNORE INTO `kb3_item_types` VALUES (783, 'Cyber X Specials', 0);
351        INSERT IGNORE INTO `kb3_item_types` VALUES (785, 'Script', 0);
352        INSERT IGNORE INTO `kb3_item_types` VALUES (786, 'Rig Electronics Superiority', 5);
353        INSERT IGNORE INTO `kb3_item_types` VALUES (722, 'Advanced Hybrid Ammo Blueprint', 0);
354        INSERT IGNORE INTO `kb3_item_types` VALUES (723, 'Tractor Beam Blueprint', 0);
355        INSERT IGNORE INTO `kb3_item_types` VALUES (724, 'Implant Blueprints', 0);
356        INSERT IGNORE INTO `kb3_item_types` VALUES (725, 'Advanced Projectile Ammo Blueprint', 0);
357        INSERT IGNORE INTO `kb3_item_types` VALUES (726, 'Advanced Frequency Crystal Blueprint', 0);
358        INSERT IGNORE INTO `kb3_item_types` VALUES (727, 'Mining Crystal Blueprint', 0);
359        INSERT IGNORE INTO `kb3_item_types` VALUES (728, 'Decryptors - Amarr', 0);
360        INSERT IGNORE INTO `kb3_item_types` VALUES (729, 'Decryptors - Minmatar', 0);
361        INSERT IGNORE INTO `kb3_item_types` VALUES (730, 'Decryptors - Gallente', 0);
362        INSERT IGNORE INTO `kb3_item_types` VALUES (731, 'Decryptors - Caldari', 0);
363        INSERT IGNORE INTO `kb3_item_types` VALUES (732, 'Decryptors - Sleepers', 0);
364        INSERT IGNORE INTO `kb3_item_types` VALUES (733, 'Decryptors - Yan Jung', 0);
365        INSERT IGNORE INTO `kb3_item_types` VALUES (734, 'Decryptors - Takmahl', 0);
366        INSERT IGNORE INTO `kb3_item_types` VALUES (735, 'Decryptors - Talocan', 0);
367        INSERT IGNORE INTO `kb3_item_types` VALUES (754, 'Salvaged Materials', 0);
368        INSERT IGNORE INTO `kb3_item_types` VALUES (784, 'Large Collidable Ship', 0);
369        INSERT IGNORE INTO `kb3_item_types` VALUES (787, 'Rig Blueprint', 0);
370        ";
371    $query = explode("\n", $queries);
372    foreach ($query as $querystring)
373    {
374        if ($string = trim(str_replace(');', ')', $querystring)))
375        {
376            $qry->execute($string);
377        }
378    }
379}
380function chk_kb3_items2()
381{
382    $qry = new DBQuery();
383    $query = 'select itm_externalid from kb3_items where itm_name = \'Repair Drone\'';
384    $result = mysql_query($query);
385    $result = mysql_fetch_array($result);
386    if ($result['itm_externalid'] == '9871')
387    {
388        return;
389    }
390    $queries = "
391            update kb3_items set itm_externalid='10246' where itm_name='Mining Drone I';
392            update kb3_items set itm_externalid='10248' where itm_name='Mining Drone - Improved UNUSED';
393            update kb3_items set itm_externalid='10250' where itm_name='Mining Drone II';
394            update kb3_items set itm_externalid='1187' where itm_name='Mining Drone - Elite';
395            update kb3_items set itm_externalid='1201' where itm_name='Proximity Drone';
396            update kb3_items set itm_externalid='1202' where itm_name='Wasp I';
397            update kb3_items set itm_externalid='15508' where itm_name='Civilian Mining Drone';
398            update kb3_items set itm_externalid='15510' where itm_name='Vespa I';
399            update kb3_items set itm_externalid='16206' where itm_name='Valkyrie I';
400            update kb3_items set itm_externalid='17565' where itm_name='Hellhound I';
401            update kb3_items set itm_externalid='21050' where itm_name='Unanchoring Drone';
402            update kb3_items set itm_externalid='21638' where itm_name='Survey Drone';
403            update kb3_items set itm_externalid='21640' where itm_name='Vespa II';
404            update kb3_items set itm_externalid='2173' where itm_name='Valkyrie II';
405            update kb3_items set itm_externalid='2175' where itm_name='Infiltrator I';
406            update kb3_items set itm_externalid='2183' where itm_name='Infiltrator II';
407            update kb3_items set itm_externalid='2185' where itm_name='Hammerhead I';
408            update kb3_items set itm_externalid='2193' where itm_name='Hammerhead II';
409            update kb3_items set itm_externalid='2195' where itm_name='Praetor I';
410            update kb3_items set itm_externalid='2203' where itm_name='Praetor II';
411            update kb3_items set itm_externalid='2205' where itm_name='Acolyte I';
412            update kb3_items set itm_externalid='2205' where itm_name='Acolyte II';
413            update kb3_items set itm_externalid='22572' where itm_name='Praetor EV-900';
414            update kb3_items set itm_externalid='22574' where itm_name='Warp Scrambling Drone';
415            update kb3_items set itm_externalid='22713' where itm_name='10mn webscramblifying Drone';
416            update kb3_items set itm_externalid='22765' where itm_name='Heavy Shield Maintenance Bot I';
417            update kb3_items set itm_externalid='22780' where itm_name='Fighter Uno';
418            update kb3_items set itm_externalid='23055' where itm_name='Templar';
419            update kb3_items set itm_externalid='23057' where itm_name='Dragonfly';
420            update kb3_items set itm_externalid='23059' where itm_name='Firbolg';
421            update kb3_items set itm_externalid='23061' where itm_name='Einherji';
422            update kb3_items set itm_externalid='23473' where itm_name='Wasp EC-900';
423            update kb3_items set itm_externalid='23506' where itm_name='Ogre SD-900';
424            update kb3_items set itm_externalid='23510' where itm_name='Praetor TD-900';
425            update kb3_items set itm_externalid='23512' where itm_name='Berserker TP-900';
426            update kb3_items set itm_externalid='23523' where itm_name='Heavy Armor Maintenance Bot I';
427            update kb3_items set itm_externalid='23525' where itm_name='Curator I';
428            update kb3_items set itm_externalid='23559' where itm_name='Berserker SW-900';
429            update kb3_items set itm_externalid='23559' where itm_name='Warden I';
430            update kb3_items set itm_externalid='23561' where itm_name='Garde I';
431            update kb3_items set itm_externalid='23563' where itm_name='Bouncer I';
432            update kb3_items set itm_externalid='23659' where itm_name='Acolyte EV-300';
433            update kb3_items set itm_externalid='23702' where itm_name='Infiltrator EV-600';
434            update kb3_items set itm_externalid='23705' where itm_name='Vespa EC-600';
435            update kb3_items set itm_externalid='23707' where itm_name='Hornet EC-300';
436            update kb3_items set itm_externalid='23709' where itm_name='Medium Armor Maintenance Bot I';
437            update kb3_items set itm_externalid='23711' where itm_name='Light Armor Maintenance Bot I';
438            update kb3_items set itm_externalid='23713' where itm_name='Hammerhead SD-600';
439            update kb3_items set itm_externalid='23715' where itm_name='Hobgoblin SD-300';
440            update kb3_items set itm_externalid='23717' where itm_name='Medium Shield Maintenance Bot I';
441            update kb3_items set itm_externalid='23719' where itm_name='Light Shield Maintenance Bot I';
442            update kb3_items set itm_externalid='23721' where itm_name='Valkyrie TP-600';
443            update kb3_items set itm_externalid='23723' where itm_name='Warrior TP-300';
444            update kb3_items set itm_externalid='23725' where itm_name='Infiltrator TD-600';
445            update kb3_items set itm_externalid='23727' where itm_name='Acolyte TD-300';
446            update kb3_items set itm_externalid='23729' where itm_name='Valkyrie SW-600';
447            update kb3_items set itm_externalid='23731' where itm_name='Warrior SW-300';
448            update kb3_items set itm_externalid='23759' where itm_name='FA-14 Templar';
449            update kb3_items set itm_externalid='2436' where itm_name='Wasp II';
450            update kb3_items set itm_externalid='2444' where itm_name='Ogre I';
451            update kb3_items set itm_externalid='2446' where itm_name='Ogre II';
452            update kb3_items set itm_externalid='2454' where itm_name='Hobgoblin I';
453            update kb3_items set itm_externalid='2456' where itm_name='Hobgoblin II';
454            update kb3_items set itm_externalid='24618' where itm_name='horrible tracking drone';
455            update kb3_items set itm_externalid='2464' where itm_name='Hornet I';
456            update kb3_items set itm_externalid='2466' where itm_name='Hornet II';
457            update kb3_items set itm_externalid='2476' where itm_name='Berserker I';
458            update kb3_items set itm_externalid='2478' where itm_name='Berserker II';
459            update kb3_items set itm_externalid='2486' where itm_name='Warrior I';
460            update kb3_items set itm_externalid='2488' where itm_name='Warrior II';
461            update kb3_items set itm_externalid='3218' where itm_name='Harvester Mining Drone';
462            update kb3_items set itm_externalid='3549' where itm_name='Tutorial Attack Drone';
463            update kb3_items set itm_externalid='9871' where itm_name='Repair Drone';
464        ";
465    $query = explode("\n", $queries);
466    foreach ($query as $querystring)
467    {
468        if ($string = trim(str_replace(');', ')', $querystring)))
469        {
470            $qry->execute($string);
471        }
472    }
473}
474function check_tblstrct6()
475{
476    $qry = new DBQuery();
477    $query = 'select all_img from kb3_alliances limit 1';
478    $result = mysql_query($query);
479    if (!$result)
480    {
481        return;
482    }
483    $query = 'ALTER TABLE `kb3_alliances` DROP `all_img`';
484    $qry->execute($query);
485}
486?>
Note: See TracBrowser for help on using the browser.