1 | <?php |
---|
2 | $stoppage = false; |
---|
3 | |
---|
4 | include_once('../config.php'); |
---|
5 | $db = mysql_connect(DB_HOST, DB_USER, DB_PASS); |
---|
6 | mysql_select_db(DB_NAME); |
---|
7 | |
---|
8 | $site = KB_SITE; |
---|
9 | $adminpw = ADMIN_PASSWORD; |
---|
10 | $dbhost = DB_HOST; |
---|
11 | $db = DB_NAME; |
---|
12 | $user = DB_USER; |
---|
13 | $pass = DB_PASS; |
---|
14 | |
---|
15 | $config = preg_replace("/\{([^\}]+)\}/e", "\\1", join('', file('config.tpl'))); |
---|
16 | $fp = fopen('../kbconfig.php', 'w'); |
---|
17 | fwrite($fp, trim($config)); |
---|
18 | fclose($fp); |
---|
19 | chmod('../kbconfig.php', 0440); |
---|
20 | |
---|
21 | function insertConfig($key, $value) |
---|
22 | { |
---|
23 | global $db; |
---|
24 | |
---|
25 | $result = mysql_query('select * from kb3_config where cfg_site=\''.KB_SITE.'\' and cfg_key=\''.$key.'\''); |
---|
26 | if (!$row = mysql_fetch_row($result)) |
---|
27 | { |
---|
28 | $sql = "insert into kb3_config values ('".KB_SITE."','".$key."','".$value."')"; |
---|
29 | mysql_query($sql); |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | // move stuff from the config to the database |
---|
34 | insertConfig('cfg_allianceid', ALLIANCE_ID); |
---|
35 | insertConfig('cfg_corpid', CORP_ID); |
---|
36 | |
---|
37 | insertConfig('cfg_common', COMMON_URL); |
---|
38 | insertConfig('cfg_img', IMG_URL); |
---|
39 | insertConfig('cfg_kbhost', KB_HOST); |
---|
40 | insertConfig('cfg_style', STYLE_URL); |
---|
41 | insertConfig('cfg_kbtitle', KB_TITLE); |
---|
42 | |
---|
43 | insertConfig('cfg_profile', KB_PROFILE); |
---|
44 | insertConfig('cfg_qcache', DB_USE_QCACHE); |
---|
45 | insertConfig('cfg_sqlhalt', DB_HALTONERROR); |
---|
46 | |
---|
47 | insertConfig('cfg_mainsite', MAIN_SITE); |
---|
48 | |
---|
49 | echo 'Upgrdaded your Config.<br/>'; |
---|
50 | |
---|
51 | echo 'The next query checks for abandoned items, save this list for your reference.<br/>'; |
---|
52 | |
---|
53 | $query = "select itd_kll_id, itm_id, itm_name |
---|
54 | from kb3_items_destroyed |
---|
55 | left join kb3_items on itd_itm_id=itm_id |
---|
56 | left join invtypes on itm_name=typeName |
---|
57 | where invtypes.typeID is null"; |
---|
58 | $result = mysql_query($query); |
---|
59 | while ($row = mysql_fetch_array($result)) |
---|
60 | { |
---|
61 | echo 'Killmail id '.$row['itd_kll_id'].' contains item named "'.$row['itm_name'].'" (id '.$row['itm_id'].') that will get orphaned.<br/>'; |
---|
62 | } |
---|
63 | ?> |
---|
64 | <p>Warning!</p><br/> |
---|
65 | Once you click for the next step the following querys will be run:<br/> |
---|
66 | <pre> |
---|
67 | update |
---|
68 | kb3_items_destroyed |
---|
69 | left join kb3_items on itd_itm_id=itm_id |
---|
70 | left join kb3_invtypes on itm_name=typeName |
---|
71 | set itd_itm_id=typeID |
---|
72 | |
---|
73 | update |
---|
74 | kb3_inv_detail |
---|
75 | left join kb3_items on ind_wep_id=itm_id |
---|
76 | left join kb3_invtypes on itm_name=typeName |
---|
77 | set ind_wep_id=typeID |
---|
78 | |
---|
79 | insert into kb3_item_price |
---|
80 | select typeID, itm_value as price |
---|
81 | from kb3_items |
---|
82 | left join kb3_invtypes on itm_name=typeName |
---|
83 | where typeID is not null and itm_value != 0 and itm_value!=basePrice |
---|
84 | </pre> |
---|
85 | |
---|
86 | Make sure you backed up those tables!<br/> |
---|
87 | <?php if ($stoppage) |
---|
88 | { |
---|
89 | return; |
---|
90 | }?> |
---|
91 | <p><a href="?step=<?php echo ($_SESSION['state']+1); ?>">Next Step</a></p> |
---|