root/dev/install/install_step41.php @ 274

Revision 274, 2.7 KB (checked in by exi, 15 years ago)

Added new german translation parsing.
Changed upgrade sql so it doesn't kill all rows if something is wrong.

Line 
1<?php
2$stoppage = false;
3
4include_once('../config.php');
5$db = mysql_connect(DB_HOST, DB_USER, DB_PASS);
6mysql_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');
17fwrite($fp, trim($config));
18fclose($fp);
19chmod('../kbconfig.php', 0440);
20
21function 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
34insertConfig('cfg_allianceid', ALLIANCE_ID);
35insertConfig('cfg_corpid', CORP_ID);
36
37insertConfig('cfg_common', COMMON_URL);
38insertConfig('cfg_img', IMG_URL);
39insertConfig('cfg_kbhost', KB_HOST);
40insertConfig('cfg_style', STYLE_URL);
41insertConfig('cfg_kbtitle', KB_TITLE);
42
43insertConfig('cfg_profile', KB_PROFILE);
44insertConfig('cfg_qcache', DB_USE_QCACHE);
45insertConfig('cfg_sqlhalt', DB_HALTONERROR);
46
47insertConfig('cfg_mainsite', MAIN_SITE);
48
49echo 'Upgraded your Config and chmodded ../kbconfig.php 440. If there was a warning for chmod please change the permission manually.<br/>';
50
51echo '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
54from kb3_items_destroyed
55left join kb3_items on itd_itm_id=itm_id
56left join invtypes on itm_name=typeName
57where invtypes.typeID is null";
58$result = mysql_query($query);
59echo mysql_error();
60while ($row = mysql_fetch_array($result))
61{
62    echo 'Killmail id '.$row['itd_kll_id'].' contains item named "'.$row['itm_name'].'" (id '.$row['itm_id'].') that will get orphaned.<br/>';
63}
64?>
65<p>Warning!</p><br/>
66Once you click for the next step the following querys will be run:<br/>
67<pre>
68update
69kb3_items_destroyed
70left join kb3_items on itd_itm_id=itm_id
71left join kb3_invtypes on itm_name=typeName
72set itd_itm_id=typeID
73
74update
75kb3_inv_detail
76left join kb3_items on ind_wep_id=itm_id
77left join kb3_invtypes on itm_name=typeName
78set ind_wep_id=typeID
79
80insert into kb3_item_price
81select typeID, itm_value as price
82from kb3_items
83left join kb3_invtypes on itm_name=typeName
84where typeID is not null and itm_value != 0 and itm_value!=basePrice
85</pre>
86
87Make sure you backed up those tables!<br/>
88<?php if ($stoppage)
89{
90    return;
91}?>
92<p><a href="?step=<?php echo ($_SESSION['state']+1); ?>">Next Step</a></p>
Note: See TracBrowser for help on using the browser.