root/dev/install/install_step41.php @ 271

Revision 271, 2.5 KB (checked in by exi, 15 years ago)

Removed failpage check on step41

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 'Upgrdaded your Config.<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);
59while ($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/>
65Once you click for the next step the following querys will be run:<br/>
66<pre>
67update
68kb3_items_destroyed
69left join kb3_items on itd_itm_id=itm_id
70left join kb3_invtypes on itm_name=typeName
71set itd_itm_id=typeID
72
73update
74kb3_inv_detail
75left join kb3_items on ind_wep_id=itm_id
76left join kb3_invtypes on itm_name=typeName
77set ind_wep_id=typeID
78
79insert into kb3_item_price
80select typeID, itm_value as price
81from kb3_items
82left join kb3_invtypes on itm_name=typeName
83where typeID is not null and itm_value != 0 and itm_value!=basePrice
84</pre>
85
86Make 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>
Note: See TracBrowser for help on using the browser.