root/dev/install/install_step41.php @ 400

Revision 400, 2.7 KB (checked in by kovell, 13 years ago)

Fixes: install is locked after first run, private cache files made inaccesible, initial summary caching removed from kill posting, board will not attempt to run on MySQL < 4.1, PILOT_ID cannot be set, legacy option removed from admin panel, pos values added to installation defaults

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