@@ -22,19 +22,19 @@ |
||
22 | 22 | */ |
23 | 23 | switch($mode) |
24 | 24 | { |
25 | - case SNC_MODE_REGISTER: |
|
26 | - if($config->server_updater_key || $config->server_updater_id) |
|
27 | - { |
|
28 | - if($ajax) |
|
25 | + case SNC_MODE_REGISTER: |
|
26 | + if($config->server_updater_key || $config->server_updater_id) |
|
29 | 27 | { |
30 | - print(SNC_VER_REGISTER_ERROR_REGISTERED); |
|
28 | + if($ajax) |
|
29 | + { |
|
30 | + print(SNC_VER_REGISTER_ERROR_REGISTERED); |
|
31 | + } |
|
32 | + die(); |
|
31 | 33 | } |
32 | - die(); |
|
33 | - } |
|
34 | - $url .= "&name=" . urlencode($config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
35 | -//TODO REMOVE DEBUG!!! |
|
36 | -//$url .= "&name=" . urlencode($config->game_name) . "&url=" . urlencode('http://supernova.ws/'); |
|
37 | - break; |
|
34 | + $url .= "&name=" . urlencode($config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
35 | + //TODO REMOVE DEBUG!!! |
|
36 | + //$url .= "&name=" . urlencode($config->game_name) . "&url=" . urlencode('http://supernova.ws/'); |
|
37 | + break; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $check_result = sn_get_url_contents($url); |
@@ -69,121 +69,121 @@ discard block |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | switch ($fleet_page) { |
72 | - case 3: |
|
72 | + case 3: |
|
73 | 73 | |
74 | - case 2: |
|
75 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
76 | - $fleetarray = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet')))); |
|
77 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
74 | + case 2: |
|
75 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
76 | + $fleetarray = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet')))); |
|
77 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
78 | 78 | |
79 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
80 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
81 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
82 | - die(); |
|
83 | - } |
|
84 | - $ship_amount = floatval($ship_amount); |
|
85 | - } |
|
86 | - |
|
87 | - $UsedPlanet = false; |
|
88 | - $YourPlanet = false; |
|
89 | - $missiontype = array(); |
|
90 | - if ($planet > $config->game_maxPlanet) { |
|
91 | - $target_mission = MT_EXPLORE; |
|
92 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
93 | - } elseif ($galaxy && $system && $planet) { |
|
94 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
95 | - |
|
96 | - $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
97 | - |
|
98 | - if ($TargetPlanet['id_owner']) { |
|
99 | - $UsedPlanet = true; |
|
100 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
101 | - $YourPlanet = true; |
|
79 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
80 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
81 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
82 | + die(); |
|
102 | 83 | } |
84 | + $ship_amount = floatval($ship_amount); |
|
103 | 85 | } |
104 | 86 | |
105 | - if (!$UsedPlanet) { |
|
106 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
107 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
108 | - $target_mission = MT_COLONIZE; |
|
109 | - $planet_type = PT_PLANET; |
|
110 | - } else { |
|
111 | - message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
112 | - } |
|
113 | - } else { |
|
114 | - $recyclers = 0; |
|
115 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
116 | - $recyclers += $fleetarray[$recycler_id]; |
|
87 | + $UsedPlanet = false; |
|
88 | + $YourPlanet = false; |
|
89 | + $missiontype = array(); |
|
90 | + if ($planet > $config->game_maxPlanet) { |
|
91 | + $target_mission = MT_EXPLORE; |
|
92 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
93 | + } elseif ($galaxy && $system && $planet) { |
|
94 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
95 | + |
|
96 | + $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
97 | + |
|
98 | + if ($TargetPlanet['id_owner']) { |
|
99 | + $UsedPlanet = true; |
|
100 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
101 | + $YourPlanet = true; |
|
102 | + } |
|
117 | 103 | } |
118 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
119 | - $target_mission = MT_RECYCLE; |
|
120 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
121 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
122 | - if ($YourPlanet) { |
|
123 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
124 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
104 | + |
|
105 | + if (!$UsedPlanet) { |
|
106 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
107 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
108 | + $target_mission = MT_COLONIZE; |
|
109 | + $planet_type = PT_PLANET; |
|
125 | 110 | } else { |
126 | - // Not Your Planet |
|
127 | - if ($fleetarray[SHIP_SPY]) { |
|
128 | - // Only spy missions if any spy |
|
129 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
111 | + message ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
112 | + } |
|
113 | + } else { |
|
114 | + $recyclers = 0; |
|
115 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
116 | + $recyclers += $fleetarray[$recycler_id]; |
|
117 | + } |
|
118 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
119 | + $target_mission = MT_RECYCLE; |
|
120 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
121 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
122 | + if ($YourPlanet) { |
|
123 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
124 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
130 | 125 | } else { |
131 | - // If no spies... |
|
132 | - if ($fleet_group_mr) { |
|
133 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
126 | + // Not Your Planet |
|
127 | + if ($fleetarray[SHIP_SPY]) { |
|
128 | + // Only spy missions if any spy |
|
129 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
134 | 130 | } else { |
135 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
136 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
137 | - |
|
138 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
139 | - |
|
140 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
141 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
131 | + // If no spies... |
|
132 | + if ($fleet_group_mr) { |
|
133 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
134 | + } else { |
|
135 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
136 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
137 | + |
|
138 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
139 | + |
|
140 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
141 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
142 | + } |
|
142 | 143 | } |
143 | 144 | } |
144 | 145 | } |
145 | 146 | } |
146 | 147 | } |
147 | 148 | } |
148 | - } |
|
149 | - |
|
150 | - if (!$target_mission && is_array($missiontype)) { |
|
151 | - $target_mission = MT_ATTACK; |
|
152 | - } |
|
153 | - |
|
154 | -// $sn_group_missions = sn_get_groups('missions'); |
|
155 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
156 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
157 | -// } |
|
158 | -// |
|
159 | -// |
|
160 | - ksort($missiontype); |
|
161 | - |
|
162 | - $speed_percent = sys_get_param_int('speed', 10); |
|
163 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
164 | - |
|
165 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
166 | - $fleet_speed = $travel_data['fleet_speed']; |
|
167 | - $distance = $travel_data['distance']; |
|
168 | - $duration = $travel_data['duration']; |
|
169 | - $consumption = $travel_data['consumption']; |
|
170 | - // No Break |
|
171 | - |
|
172 | - case 1: |
|
173 | - if ($galaxy && $system && $planet) { |
|
174 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
175 | - |
|
176 | - $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
177 | - } |
|
178 | - |
|
179 | - case 0: |
|
180 | - $template_result += array( |
|
181 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
182 | - 'thissystem' => $planetrow['system'], |
|
183 | - 'thisplanet' => $planetrow['planet'], |
|
184 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
185 | - ); |
|
186 | - // no break |
|
149 | + |
|
150 | + if (!$target_mission && is_array($missiontype)) { |
|
151 | + $target_mission = MT_ATTACK; |
|
152 | + } |
|
153 | + |
|
154 | + // $sn_group_missions = sn_get_groups('missions'); |
|
155 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
156 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
157 | + // } |
|
158 | + // |
|
159 | + // |
|
160 | + ksort($missiontype); |
|
161 | + |
|
162 | + $speed_percent = sys_get_param_int('speed', 10); |
|
163 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
164 | + |
|
165 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
166 | + $fleet_speed = $travel_data['fleet_speed']; |
|
167 | + $distance = $travel_data['distance']; |
|
168 | + $duration = $travel_data['duration']; |
|
169 | + $consumption = $travel_data['consumption']; |
|
170 | + // No Break |
|
171 | + |
|
172 | + case 1: |
|
173 | + if ($galaxy && $system && $planet) { |
|
174 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
175 | + |
|
176 | + $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
177 | + } |
|
178 | + |
|
179 | + case 0: |
|
180 | + $template_result += array( |
|
181 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
182 | + 'thissystem' => $planetrow['system'], |
|
183 | + 'thisplanet' => $planetrow['planet'], |
|
184 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
185 | + ); |
|
186 | + // no break |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
@@ -205,31 +205,31 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | switch($fleet_page) { |
208 | - case 1: |
|
209 | - require('includes/includes/flt_page1.inc'); |
|
210 | - break; |
|
208 | + case 1: |
|
209 | + require('includes/includes/flt_page1.inc'); |
|
210 | + break; |
|
211 | 211 | |
212 | - case 2: |
|
213 | - require_once('includes/includes/flt_page2.inc'); |
|
214 | - sn_fleet_page2(); |
|
215 | - break; |
|
212 | + case 2: |
|
213 | + require_once('includes/includes/flt_page2.inc'); |
|
214 | + sn_fleet_page2(); |
|
215 | + break; |
|
216 | 216 | |
217 | - case 3: |
|
218 | - require_once('includes/includes/flt_page3.inc'); |
|
219 | - sn_fleet_page3($duration); |
|
220 | - break; |
|
217 | + case 3: |
|
218 | + require_once('includes/includes/flt_page3.inc'); |
|
219 | + sn_fleet_page3($duration); |
|
220 | + break; |
|
221 | 221 | |
222 | - case 4: |
|
223 | - require('includes/includes/flt_page4.inc'); |
|
224 | - break; |
|
222 | + case 4: |
|
223 | + require('includes/includes/flt_page4.inc'); |
|
224 | + break; |
|
225 | 225 | |
226 | - case 5: |
|
227 | - require('includes/includes/flt_page5.inc'); |
|
228 | - break; |
|
226 | + case 5: |
|
227 | + require('includes/includes/flt_page5.inc'); |
|
228 | + break; |
|
229 | 229 | |
230 | - default: |
|
231 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
230 | + default: |
|
231 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
232 | 232 | |
233 | - require('includes/includes/flt_page0.inc'); |
|
234 | - break; |
|
233 | + require('includes/includes/flt_page0.inc'); |
|
234 | + break; |
|
235 | 235 | } |
@@ -48,106 +48,106 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | switch($mode) { |
51 | - case 'write': |
|
52 | - $error_list = array(); |
|
53 | - $template = gettemplate('msg_message_compose', true); |
|
51 | + case 'write': |
|
52 | + $error_list = array(); |
|
53 | + $template = gettemplate('msg_message_compose', true); |
|
54 | 54 | |
55 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
56 | - if($recipient_name) { |
|
57 | - $recipient_row = db_user_by_username($recipient_name); |
|
58 | - } |
|
55 | + $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
56 | + if($recipient_name) { |
|
57 | + $recipient_row = db_user_by_username($recipient_name); |
|
58 | + } |
|
59 | 59 | |
60 | - if(!$recipient_row) { |
|
61 | - $recipient_id = sys_get_param_id('id'); |
|
62 | - $recipient_row = db_user_by_id($recipient_id); |
|
63 | 60 | if(!$recipient_row) { |
64 | - $recipient_id = 0; |
|
61 | + $recipient_id = sys_get_param_id('id'); |
|
62 | + $recipient_row = db_user_by_id($recipient_id); |
|
63 | + if(!$recipient_row) { |
|
64 | + $recipient_id = 0; |
|
65 | + } |
|
65 | 66 | } |
66 | - } |
|
67 | - |
|
68 | - if($recipient_row) { |
|
69 | - $recipient_id = $recipient_row['id']; |
|
70 | - $recipient_name = $recipient_row['username']; |
|
71 | - } |
|
72 | - |
|
73 | - if($recipient_id == $user['id']) { |
|
74 | - $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
75 | - } |
|
76 | - |
|
77 | - $re = 0; |
|
78 | - $subject = sys_get_param_str('subject'); |
|
79 | - while(strpos($subject, $lang['msg_answer_prefix']) !== false) { |
|
80 | - $subject = substr($subject, strlen($lang['msg_answer_prefix'])); |
|
81 | - $re++; |
|
82 | - } |
|
83 | - $re ? $subject = $lang['msg_answer_prefix'] . $subject : false; |
|
84 | 67 | |
85 | - if(sys_get_param_str('msg_send')) { |
|
86 | - $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
68 | + if($recipient_row) { |
|
69 | + $recipient_id = $recipient_row['id']; |
|
70 | + $recipient_name = $recipient_row['username']; |
|
71 | + } |
|
87 | 72 | |
88 | - if(!$recipient_id) { |
|
89 | - $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
73 | + if($recipient_id == $user['id']) { |
|
74 | + $error_list[] = array('MESSAGE' => $lang['msg_err_self_send'], 'STATUS' => ERR_ERROR); |
|
90 | 75 | } |
91 | 76 | |
92 | - $text = sys_get_param_str('text'); |
|
93 | - if(!$text) { |
|
94 | - $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
77 | + $re = 0; |
|
78 | + $subject = sys_get_param_str('subject'); |
|
79 | + while(strpos($subject, $lang['msg_answer_prefix']) !== false) { |
|
80 | + $subject = substr($subject, strlen($lang['msg_answer_prefix'])); |
|
81 | + $re++; |
|
95 | 82 | } |
83 | + $re ? $subject = $lang['msg_answer_prefix'] . $subject : false; |
|
96 | 84 | |
97 | - if(empty($error_list)) { |
|
98 | - $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
85 | + if(sys_get_param_str('msg_send')) { |
|
86 | + $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
99 | 87 | |
100 | - $user_safe_name = db_escape($user['username']); |
|
101 | - $recipient_name = db_escape($recipient_name); |
|
102 | - msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true); |
|
88 | + if(!$recipient_id) { |
|
89 | + $error_list[] = array('MESSAGE' => $lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR); |
|
90 | + } |
|
103 | 91 | |
104 | - //$recipient_id = 0; |
|
105 | - //$recipient_name = ''; |
|
106 | - //$subject = ''; |
|
107 | - $text = ''; |
|
92 | + $text = sys_get_param_str('text'); |
|
93 | + if(!$text) { |
|
94 | + $error_list[] = array('MESSAGE' => $lang['msg_err_no_text'], 'STATUS' => ERR_ERROR); |
|
95 | + } |
|
108 | 96 | |
109 | - $msg_sent = true; |
|
110 | - } else { |
|
111 | - $subject = sys_get_param_str_unsafe('subject'); |
|
112 | - $text = sys_get_param_str_unsafe('text'); |
|
113 | - } |
|
114 | - $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
115 | - } |
|
97 | + if(empty($error_list)) { |
|
98 | + $error_list[] = array('MESSAGE' => $lang['msg_not_message_sent'], 'STATUS' => ERR_NONE); |
|
116 | 99 | |
117 | - $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
100 | + $user_safe_name = db_escape($user['username']); |
|
101 | + $recipient_name = db_escape($recipient_name); |
|
102 | + msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true); |
|
118 | 103 | |
119 | - $template->assign_vars(array( |
|
120 | - 'RECIPIENT_ID' => $recipient_id, |
|
121 | - 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), |
|
122 | - 'SUBJECT' => htmlspecialchars($subject), |
|
123 | - 'TEXT' => htmlspecialchars($text), |
|
124 | - )); |
|
104 | + //$recipient_id = 0; |
|
105 | + //$recipient_name = ''; |
|
106 | + //$subject = ''; |
|
107 | + $text = ''; |
|
125 | 108 | |
126 | - foreach($error_list as $error_message) { |
|
127 | - $template->assign_block_vars('result', $error_message); |
|
128 | - } |
|
109 | + $msg_sent = true; |
|
110 | + } else { |
|
111 | + $subject = sys_get_param_str_unsafe('subject'); |
|
112 | + $text = sys_get_param_str_unsafe('text'); |
|
113 | + } |
|
114 | + $recipient_name = sys_get_param_str_unsafe('recipient_name'); |
|
115 | + } |
|
129 | 116 | |
130 | - $message_query = db_message_list_get_last_20($user, $recipient_id); |
|
131 | - while($message_row = db_fetch($message_query)) { |
|
132 | - $template->assign_block_vars('messages', array( |
|
133 | - 'ID' => $message_row['message_id'], |
|
134 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
135 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
136 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
137 | - 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
117 | + $subject = $subject ? $subject : $lang['msg_subject_default']; |
|
138 | 118 | |
139 | - 'FROM_ID' => $message_row['message_sender'], |
|
119 | + $template->assign_vars(array( |
|
120 | + 'RECIPIENT_ID' => $recipient_id, |
|
121 | + 'RECIPIENT_NAME' => htmlspecialchars($recipient_name), |
|
122 | + 'SUBJECT' => htmlspecialchars($subject), |
|
123 | + 'TEXT' => htmlspecialchars($text), |
|
140 | 124 | )); |
141 | - } |
|
142 | 125 | |
143 | - break; |
|
126 | + foreach($error_list as $error_message) { |
|
127 | + $template->assign_block_vars('result', $error_message); |
|
128 | + } |
|
129 | + |
|
130 | + $message_query = db_message_list_get_last_20($user, $recipient_id); |
|
131 | + while($message_row = db_fetch($message_query)) { |
|
132 | + $template->assign_block_vars('messages', array( |
|
133 | + 'ID' => $message_row['message_id'], |
|
134 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
135 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
136 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
137 | + 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
138 | + |
|
139 | + 'FROM_ID' => $message_row['message_sender'], |
|
140 | + )); |
|
141 | + } |
|
144 | 142 | |
145 | - case 'delete': |
|
146 | - $query_add = ''; |
|
143 | + break; |
|
147 | 144 | |
148 | - $message_range = sys_get_param_str('message_range'); |
|
145 | + case 'delete': |
|
146 | + $query_add = ''; |
|
149 | 147 | |
150 | - switch($message_range) { |
|
148 | + $message_range = sys_get_param_str('message_range'); |
|
149 | + |
|
150 | + switch($message_range) { |
|
151 | 151 | case 'unchecked': |
152 | 152 | case 'checked': |
153 | 153 | $marked_message_list = sys_get_param('mark', array()); |
@@ -171,65 +171,65 @@ discard block |
||
171 | 171 | case 'all': |
172 | 172 | $query_add = $query_add ? $query_add : true; |
173 | 173 | break; |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | 176 | if($query_add) { |
177 | 177 | $query_add = $query_add === true ? '' : $query_add; |
178 | 178 | db_message_list_delete($user, $query_add); |
179 | 179 | } |
180 | 180 | |
181 | - case 'show': |
|
182 | - if($current_class == MSG_TYPE_OUTBOX) { |
|
183 | - $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
184 | - } else { |
|
185 | - if($current_class == MSG_TYPE_NEW) { |
|
186 | - $SubUpdateQry = array(); |
|
187 | - foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
188 | - if($message_class_id != MSG_TYPE_OUTBOX) { |
|
189 | - $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
190 | - $user[$message_class['name']] = 0; |
|
181 | + case 'show': |
|
182 | + if($current_class == MSG_TYPE_OUTBOX) { |
|
183 | + $message_query = db_message_list_outbox_by_user_id($user['id']); |
|
184 | + } else { |
|
185 | + if($current_class == MSG_TYPE_NEW) { |
|
186 | + $SubUpdateQry = array(); |
|
187 | + foreach($sn_message_class_list as $message_class_id => $message_class) { |
|
188 | + if($message_class_id != MSG_TYPE_OUTBOX) { |
|
189 | + $SubUpdateQry[] = "`{$message_class['name']}` = '0'"; |
|
190 | + $user[$message_class['name']] = 0; |
|
191 | + } |
|
191 | 192 | } |
193 | + $SubUpdateQry = implode(',', $SubUpdateQry); |
|
194 | + } else { |
|
195 | + $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'"; |
|
196 | + $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
197 | + |
|
198 | + $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
199 | + $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
192 | 200 | } |
193 | - $SubUpdateQry = implode(',', $SubUpdateQry); |
|
194 | - } else { |
|
195 | - $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'"; |
|
196 | - $SubSelectQry = "AND `message_type` = '{$current_class}'"; |
|
197 | 201 | |
198 | - $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']]; |
|
199 | - $user[$sn_message_class_list[$current_class]['name']] = 0; |
|
202 | + db_user_set_by_id($user['id'], $SubUpdateQry); |
|
203 | + $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
|
200 | 204 | } |
201 | 205 | |
202 | - db_user_set_by_id($user['id'], $SubUpdateQry); |
|
203 | - $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry); |
|
204 | - } |
|
205 | - |
|
206 | - if(sys_get_param_int('return')) { |
|
207 | - header('Location: messages.php'); |
|
208 | - die(); |
|
209 | - } |
|
206 | + if(sys_get_param_int('return')) { |
|
207 | + header('Location: messages.php'); |
|
208 | + die(); |
|
209 | + } |
|
210 | 210 | |
211 | - $template = gettemplate('msg_message_list', true); |
|
212 | - while($message_row = db_fetch($message_query)) { |
|
213 | - $template->assign_block_vars('messages', array( |
|
214 | - 'ID' => $message_row['message_id'], |
|
215 | - 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
216 | - 'FROM' => htmlspecialchars($message_row['message_from']), |
|
217 | - 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
218 | - 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
219 | - |
|
220 | - 'FROM_ID' => $message_row['message_sender'], |
|
221 | - 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
222 | - 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
223 | - )); |
|
224 | - } |
|
211 | + $template = gettemplate('msg_message_list', true); |
|
212 | + while($message_row = db_fetch($message_query)) { |
|
213 | + $template->assign_block_vars('messages', array( |
|
214 | + 'ID' => $message_row['message_id'], |
|
215 | + 'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF), |
|
216 | + 'FROM' => htmlspecialchars($message_row['message_from']), |
|
217 | + 'SUBJ' => htmlspecialchars($message_row['message_subject']), |
|
218 | + 'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']), |
|
219 | + |
|
220 | + 'FROM_ID' => $message_row['message_sender'], |
|
221 | + 'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']), |
|
222 | + 'STYLE' => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'], |
|
223 | + )); |
|
224 | + } |
|
225 | 225 | |
226 | - $current_class_text = $lang['msg_class'][$current_class]; |
|
226 | + $current_class_text = $lang['msg_class'][$current_class]; |
|
227 | 227 | |
228 | - $template->assign_vars(array( |
|
229 | - "MESSAGE_CLASS" => $current_class, |
|
230 | - "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
231 | - )); |
|
232 | - break; |
|
228 | + $template->assign_vars(array( |
|
229 | + "MESSAGE_CLASS" => $current_class, |
|
230 | + "MESSAGE_CLASS_TEXT" => $current_class_text, |
|
231 | + )); |
|
232 | + break; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if(!$template) { |
@@ -7,48 +7,48 @@ discard block |
||
7 | 7 | |
8 | 8 | switch($new_version) |
9 | 9 | { |
10 | - case 0: |
|
11 | - case 1: |
|
12 | - case 2: |
|
13 | - case 3: |
|
14 | - case 4: |
|
15 | - case 5: |
|
16 | - case 6: |
|
17 | - case 7: |
|
18 | - case 8: |
|
19 | - case 9: |
|
20 | - upd_log_version_update(); |
|
21 | - |
|
22 | - upd_alter_table('planets', "ADD `debris_metal` bigint(11) unsigned DEFAULT '0'", !$update_tables['planets']['debris_metal']); |
|
23 | - upd_alter_table('planets', "ADD `debris_crystal` bigint(11) unsigned DEFAULT '0'", !$update_tables['planets']['debris_crystal']); |
|
24 | - |
|
25 | - upd_alter_table('planets', array( |
|
26 | - "ADD `parent_planet` bigint(11) unsigned DEFAULT '0'", |
|
27 | - "ADD KEY `i_parent_planet` (`parent_planet`)" |
|
28 | - ), !$update_tables['planets']['parent_planet']); |
|
29 | - upd_do_query( |
|
30 | - "UPDATE `{{planets}}` AS lu |
|
10 | + case 0: |
|
11 | + case 1: |
|
12 | + case 2: |
|
13 | + case 3: |
|
14 | + case 4: |
|
15 | + case 5: |
|
16 | + case 6: |
|
17 | + case 7: |
|
18 | + case 8: |
|
19 | + case 9: |
|
20 | + upd_log_version_update(); |
|
21 | + |
|
22 | + upd_alter_table('planets', "ADD `debris_metal` bigint(11) unsigned DEFAULT '0'", !$update_tables['planets']['debris_metal']); |
|
23 | + upd_alter_table('planets', "ADD `debris_crystal` bigint(11) unsigned DEFAULT '0'", !$update_tables['planets']['debris_crystal']); |
|
24 | + |
|
25 | + upd_alter_table('planets', array( |
|
26 | + "ADD `parent_planet` bigint(11) unsigned DEFAULT '0'", |
|
27 | + "ADD KEY `i_parent_planet` (`parent_planet`)" |
|
28 | + ), !$update_tables['planets']['parent_planet']); |
|
29 | + upd_do_query( |
|
30 | + "UPDATE `{{planets}}` AS lu |
|
31 | 31 | LEFT JOIN `{{planets}}` AS pl |
32 | 32 | ON pl.galaxy=lu.galaxy AND pl.system=lu.system AND pl.planet=lu.planet AND pl.planet_type=1 |
33 | 33 | SET lu.parent_planet=pl.id WHERE lu.planet_type=3;" |
34 | - ); |
|
35 | - upd_drop_table('lunas'); |
|
34 | + ); |
|
35 | + upd_drop_table('lunas'); |
|
36 | 36 | |
37 | - if($update_tables['galaxy']) |
|
38 | - { |
|
39 | - upd_do_query( |
|
40 | - 'UPDATE `{{planets}}` |
|
37 | + if($update_tables['galaxy']) |
|
38 | + { |
|
39 | + upd_do_query( |
|
40 | + 'UPDATE `{{planets}}` |
|
41 | 41 | LEFT JOIN `{{galaxy}}` ON {{galaxy}}.id_planet = {{planets}}.id |
42 | 42 | SET |
43 | 43 | {{planets}}.debris_metal = {{galaxy}}.metal, |
44 | 44 | {{planets}}.debris_crystal = {{galaxy}}.crystal |
45 | 45 | WHERE {{galaxy}}.metal>0 OR {{galaxy}}.crystal>0;' |
46 | - ); |
|
47 | - } |
|
48 | - upd_drop_table('galaxy'); |
|
46 | + ); |
|
47 | + } |
|
48 | + upd_drop_table('galaxy'); |
|
49 | 49 | |
50 | - upd_create_table('counter', |
|
51 | - "( |
|
50 | + upd_create_table('counter', |
|
51 | + "( |
|
52 | 52 | `id` bigint(11) NOT NULL AUTO_INCREMENT, |
53 | 53 | `time` int(11) NOT NULL DEFAULT '0', |
54 | 54 | `page` varchar(255) CHARACTER SET utf8 DEFAULT '0', |
@@ -58,63 +58,63 @@ discard block |
||
58 | 58 | KEY `i_user_id` (`user_id`), |
59 | 59 | KEY `i_ip` (`ip`) |
60 | 60 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
61 | - ); |
|
62 | - upd_alter_table('counter', "ADD `url` varchar(255) CHARACTER SET utf8 DEFAULT ''", !$update_tables['counter']['url']); |
|
61 | + ); |
|
62 | + upd_alter_table('counter', "ADD `url` varchar(255) CHARACTER SET utf8 DEFAULT ''", !$update_tables['counter']['url']); |
|
63 | 63 | |
64 | - upd_alter_table('fleets', array( |
|
65 | - "ADD KEY `fleet_mess` (`fleet_mess`)", |
|
66 | - "ADD KEY `fleet_group` (`fleet_group`)" |
|
67 | - ), !$update_indexes['fleets']['fleet_mess']); |
|
64 | + upd_alter_table('fleets', array( |
|
65 | + "ADD KEY `fleet_mess` (`fleet_mess`)", |
|
66 | + "ADD KEY `fleet_group` (`fleet_group`)" |
|
67 | + ), !$update_indexes['fleets']['fleet_mess']); |
|
68 | 68 | |
69 | - upd_alter_table('referrals', "ADD `dark_matter` bigint(11) NOT NULL DEFAULT '0' COMMENT 'How much player have aquired Dark Matter'", !$update_tables['referrals']['dark_matter']); |
|
70 | - upd_alter_table('referrals', "ADD KEY `id_partner` (`id_partner`)", !$update_indexes['referrals']['id_partner']); |
|
69 | + upd_alter_table('referrals', "ADD `dark_matter` bigint(11) NOT NULL DEFAULT '0' COMMENT 'How much player have aquired Dark Matter'", !$update_tables['referrals']['dark_matter']); |
|
70 | + upd_alter_table('referrals', "ADD KEY `id_partner` (`id_partner`)", !$update_indexes['referrals']['id_partner']); |
|
71 | 71 | |
72 | - upd_check_key('rpg_bonus_divisor', 10); |
|
72 | + upd_check_key('rpg_bonus_divisor', 10); |
|
73 | 73 | |
74 | - upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('BannerURL', 'banner_source_post', 'BannerOverviewFrame', |
|
74 | + upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('BannerURL', 'banner_source_post', 'BannerOverviewFrame', |
|
75 | 75 | 'close_reason', 'dbVersion', 'ForumUserBarFrame', 'OverviewBanner', 'OverviewClickBanner', 'OverviewExternChat', |
76 | 76 | 'OverviewExternChatCmd', 'OverviewNewsText', 'UserbarURL', 'userbar_source');"); |
77 | 77 | |
78 | - $dm_change_legit = true; |
|
78 | + $dm_change_legit = true; |
|
79 | 79 | |
80 | - upd_do_query( |
|
81 | - "UPDATE {{referrals}} AS r |
|
80 | + upd_do_query( |
|
81 | + "UPDATE {{referrals}} AS r |
|
82 | 82 | LEFT JOIN {{users}} AS u |
83 | 83 | ON u.id = r.id |
84 | 84 | SET r.dark_matter = u.lvl_minier + u.lvl_raid;" |
85 | - ); |
|
86 | - upd_add_more_time(); |
|
85 | + ); |
|
86 | + upd_add_more_time(); |
|
87 | 87 | |
88 | - if($update_tables['users']['rpg_points']) |
|
89 | - { |
|
90 | - upd_do_query( |
|
91 | - "UPDATE {{users}} AS u |
|
88 | + if($update_tables['users']['rpg_points']) |
|
89 | + { |
|
90 | + upd_do_query( |
|
91 | + "UPDATE {{users}} AS u |
|
92 | 92 | RIGHT JOIN {{referrals}} AS r |
93 | 93 | ON r.id_partner = u.id AND r.dark_matter >= {$config->rpg_bonus_divisor} |
94 | 94 | SET u.rpg_points = u.rpg_points + FLOOR(r.dark_matter/{$config->rpg_bonus_divisor});" |
95 | - ); |
|
96 | - } |
|
95 | + ); |
|
96 | + } |
|
97 | 97 | |
98 | - $dm_change_legit = false; |
|
99 | - upd_do_query('COMMIT;', true); |
|
100 | - $new_version = 10; |
|
101 | - |
|
102 | - case 10: |
|
103 | - case 11: |
|
104 | - case 12: |
|
105 | - case 13: |
|
106 | - case 14: |
|
107 | - case 15: |
|
108 | - case 16: |
|
109 | - case 17: |
|
110 | - case 18: |
|
111 | - case 19: |
|
112 | - case 20: |
|
113 | - case 21: |
|
114 | - upd_log_version_update(); |
|
115 | - |
|
116 | - upd_create_table('alliance_requests', |
|
117 | - "( |
|
98 | + $dm_change_legit = false; |
|
99 | + upd_do_query('COMMIT;', true); |
|
100 | + $new_version = 10; |
|
101 | + |
|
102 | + case 10: |
|
103 | + case 11: |
|
104 | + case 12: |
|
105 | + case 13: |
|
106 | + case 14: |
|
107 | + case 15: |
|
108 | + case 16: |
|
109 | + case 17: |
|
110 | + case 18: |
|
111 | + case 19: |
|
112 | + case 20: |
|
113 | + case 21: |
|
114 | + upd_log_version_update(); |
|
115 | + |
|
116 | + upd_create_table('alliance_requests', |
|
117 | + "( |
|
118 | 118 | `id_user` int(11) NOT NULL, |
119 | 119 | `id_ally` int(11) NOT NULL DEFAULT '0', |
120 | 120 | `request_text` text, |
@@ -122,103 +122,103 @@ discard block |
||
122 | 122 | `request_denied` tinyint(1) unsigned NOT NULL DEFAULT '0', |
123 | 123 | PRIMARY KEY (`id_user`,`id_ally`) |
124 | 124 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8;" |
125 | - ); |
|
126 | - |
|
127 | - upd_alter_table('announce', "ADD `detail_url` varchar(250) NOT NULL DEFAULT '' COMMENT 'Link to more details about update'", !$update_tables['announce']['detail_url']); |
|
128 | - |
|
129 | - upd_alter_table('counter', array("MODIFY `ip` VARCHAR(250) COMMENT 'User last IP'", "ADD `proxy` VARCHAR(250) NOT NULL DEFAULT '' COMMENT 'User proxy (if any)'"), !$update_tables['counter']['proxy']); |
|
130 | - |
|
131 | - upd_alter_table('statpoints', array( |
|
132 | - "ADD `res_rank` INT(11) DEFAULT 0 COMMENT 'Rank by resources'", |
|
133 | - "ADD `res_old_rank` INT(11) DEFAULT 0 COMMENT 'Old rank by resources'", |
|
134 | - "ADD `res_points` BIGINT(20) DEFAULT 0 COMMENT 'Resource stat points'", |
|
135 | - "ADD `res_count` BIGINT(20) DEFAULT 0 COMMENT 'Old rank by resources'" |
|
136 | - ), !$update_tables['statpoints']['res_rank']); |
|
137 | - |
|
138 | - upd_alter_table('planets', "ADD `supercargo` bigint(11) NOT NULL DEFAULT '0' COMMENT 'Supercargo ship count'", !$update_tables['planets']['supercargo']); |
|
139 | - |
|
140 | - upd_alter_table('users', "DROP COLUMN `current_luna`", $update_tables['users']['current_luna']); |
|
141 | - upd_alter_table('users', array("DROP COLUMN `aktywnosc`", "DROP COLUMN `time_aktyw`", "DROP COLUMN `kiler`", |
|
142 | - "DROP COLUMN `kod_aktywujacy`", "DROP COLUMN `ataker`", "DROP COLUMN `atakin`"), $update_tables['users']['ataker']); |
|
143 | - upd_alter_table('users', "ADD `options` TEXT COMMENT 'Packed user options'", !$update_tables['users']['options']); |
|
144 | - upd_alter_table('users', "ADD `news_lastread` int(11) NOT NULL DEFAULT '0' COMMENT 'News last read date'", !$update_tables['users']['news_lastread']); |
|
145 | - upd_alter_table('users', array("MODIFY `user_lastip` VARCHAR(250) COMMENT 'User last IP'", "ADD `user_proxy` VARCHAR(250) NOT NULL DEFAULT '' COMMENT 'User proxy (if any)'"), !$update_tables['users']['user_proxy']); |
|
146 | - |
|
147 | - upd_drop_table('update'); |
|
148 | - |
|
149 | - upd_check_key('fleet_speed', $config->fleet_speed/2500, $config->fleet_speed >= 2500); |
|
150 | - upd_check_key('game_counter', 0); |
|
151 | - upd_check_key('game_default_language', 'ru'); |
|
152 | - upd_check_key('game_default_skin', 'skins/EpicBlue/'); |
|
153 | - upd_check_key('game_default_template', 'OpenGame'); |
|
154 | - upd_check_key('game_news_overview', 3); |
|
155 | - upd_check_key('game_news_actual', 259200); |
|
156 | - upd_check_key('game_noob_factor', 5, !isset($config->game_noob_factor)); |
|
157 | - upd_check_key('game_noob_points', 5000, !isset($config->game_noob_points)); |
|
158 | - upd_check_key('game_speed', $config->game_speed/2500, $config->game_speed >= 2500); |
|
159 | - upd_check_key('int_format_date', 'd.m.Y'); |
|
160 | - upd_check_key('int_format_time', 'H:i:s', true); |
|
161 | - upd_check_key('int_banner_background', 'design/images/banner.png', true); |
|
162 | - upd_check_key('int_userbar_background', 'design/images/userbar.png', true); |
|
163 | - upd_check_key('player_max_colonies', $config->player_max_planets ? ($config->player_max_planets - 1) : 9); |
|
164 | - upd_check_key('url_forum', $config->forum_url, !isset($config->url_forum)); |
|
165 | - upd_check_key('url_rules', $config->rules_url, !isset($config->url_rules)); |
|
166 | - upd_check_key('url_dark_matter', '', !isset($config->url_dark_matter)); |
|
167 | - |
|
168 | - upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ( |
|
125 | + ); |
|
126 | + |
|
127 | + upd_alter_table('announce', "ADD `detail_url` varchar(250) NOT NULL DEFAULT '' COMMENT 'Link to more details about update'", !$update_tables['announce']['detail_url']); |
|
128 | + |
|
129 | + upd_alter_table('counter', array("MODIFY `ip` VARCHAR(250) COMMENT 'User last IP'", "ADD `proxy` VARCHAR(250) NOT NULL DEFAULT '' COMMENT 'User proxy (if any)'"), !$update_tables['counter']['proxy']); |
|
130 | + |
|
131 | + upd_alter_table('statpoints', array( |
|
132 | + "ADD `res_rank` INT(11) DEFAULT 0 COMMENT 'Rank by resources'", |
|
133 | + "ADD `res_old_rank` INT(11) DEFAULT 0 COMMENT 'Old rank by resources'", |
|
134 | + "ADD `res_points` BIGINT(20) DEFAULT 0 COMMENT 'Resource stat points'", |
|
135 | + "ADD `res_count` BIGINT(20) DEFAULT 0 COMMENT 'Old rank by resources'" |
|
136 | + ), !$update_tables['statpoints']['res_rank']); |
|
137 | + |
|
138 | + upd_alter_table('planets', "ADD `supercargo` bigint(11) NOT NULL DEFAULT '0' COMMENT 'Supercargo ship count'", !$update_tables['planets']['supercargo']); |
|
139 | + |
|
140 | + upd_alter_table('users', "DROP COLUMN `current_luna`", $update_tables['users']['current_luna']); |
|
141 | + upd_alter_table('users', array("DROP COLUMN `aktywnosc`", "DROP COLUMN `time_aktyw`", "DROP COLUMN `kiler`", |
|
142 | + "DROP COLUMN `kod_aktywujacy`", "DROP COLUMN `ataker`", "DROP COLUMN `atakin`"), $update_tables['users']['ataker']); |
|
143 | + upd_alter_table('users', "ADD `options` TEXT COMMENT 'Packed user options'", !$update_tables['users']['options']); |
|
144 | + upd_alter_table('users', "ADD `news_lastread` int(11) NOT NULL DEFAULT '0' COMMENT 'News last read date'", !$update_tables['users']['news_lastread']); |
|
145 | + upd_alter_table('users', array("MODIFY `user_lastip` VARCHAR(250) COMMENT 'User last IP'", "ADD `user_proxy` VARCHAR(250) NOT NULL DEFAULT '' COMMENT 'User proxy (if any)'"), !$update_tables['users']['user_proxy']); |
|
146 | + |
|
147 | + upd_drop_table('update'); |
|
148 | + |
|
149 | + upd_check_key('fleet_speed', $config->fleet_speed/2500, $config->fleet_speed >= 2500); |
|
150 | + upd_check_key('game_counter', 0); |
|
151 | + upd_check_key('game_default_language', 'ru'); |
|
152 | + upd_check_key('game_default_skin', 'skins/EpicBlue/'); |
|
153 | + upd_check_key('game_default_template', 'OpenGame'); |
|
154 | + upd_check_key('game_news_overview', 3); |
|
155 | + upd_check_key('game_news_actual', 259200); |
|
156 | + upd_check_key('game_noob_factor', 5, !isset($config->game_noob_factor)); |
|
157 | + upd_check_key('game_noob_points', 5000, !isset($config->game_noob_points)); |
|
158 | + upd_check_key('game_speed', $config->game_speed/2500, $config->game_speed >= 2500); |
|
159 | + upd_check_key('int_format_date', 'd.m.Y'); |
|
160 | + upd_check_key('int_format_time', 'H:i:s', true); |
|
161 | + upd_check_key('int_banner_background', 'design/images/banner.png', true); |
|
162 | + upd_check_key('int_userbar_background', 'design/images/userbar.png', true); |
|
163 | + upd_check_key('player_max_colonies', $config->player_max_planets ? ($config->player_max_planets - 1) : 9); |
|
164 | + upd_check_key('url_forum', $config->forum_url, !isset($config->url_forum)); |
|
165 | + upd_check_key('url_rules', $config->rules_url, !isset($config->url_rules)); |
|
166 | + upd_check_key('url_dark_matter', '', !isset($config->url_dark_matter)); |
|
167 | + |
|
168 | + upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ( |
|
169 | 169 | 'game_date_withTime', 'player_max_planets', 'OverviewNewsFrame', 'forum_url', 'rules_url' |
170 | 170 | );"); |
171 | 171 | |
172 | - upd_do_query('COMMIT;', true); |
|
173 | - $new_version = 22; |
|
172 | + upd_do_query('COMMIT;', true); |
|
173 | + $new_version = 22; |
|
174 | 174 | |
175 | - case 22: |
|
176 | - upd_log_version_update(); |
|
175 | + case 22: |
|
176 | + upd_log_version_update(); |
|
177 | 177 | |
178 | - upd_alter_table('planets', "ADD `governor` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Planet governor'", !$update_tables['planets']['governor']); |
|
179 | - upd_alter_table('planets', "ADD `governor_level` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Governor level'", !$update_tables['planets']['governor_level']); |
|
180 | - upd_alter_table('planets', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'Planet que'", !$update_tables['planets']['que']); |
|
178 | + upd_alter_table('planets', "ADD `governor` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Planet governor'", !$update_tables['planets']['governor']); |
|
179 | + upd_alter_table('planets', "ADD `governor_level` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Governor level'", !$update_tables['planets']['governor_level']); |
|
180 | + upd_alter_table('planets', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'Planet que'", !$update_tables['planets']['que']); |
|
181 | 181 | |
182 | - if($update_tables['planets']['b_building']) |
|
183 | - { |
|
184 | - $planet_query = upd_do_query('SELECT * FROM {{planets}} WHERE `b_building` <> 0;'); |
|
185 | - $const_que_structures = QUE_STRUCTURES; |
|
186 | - while($planet_data = db_fetch($planet_query)) |
|
182 | + if($update_tables['planets']['b_building']) |
|
187 | 183 | { |
188 | - $old_que = explode(';', $planet_data['b_building_id']); |
|
189 | - foreach($old_que as $old_que_item_string) |
|
184 | + $planet_query = upd_do_query('SELECT * FROM {{planets}} WHERE `b_building` <> 0;'); |
|
185 | + $const_que_structures = QUE_STRUCTURES; |
|
186 | + while($planet_data = db_fetch($planet_query)) |
|
190 | 187 | { |
191 | - if(!$old_que_item_string) |
|
188 | + $old_que = explode(';', $planet_data['b_building_id']); |
|
189 | + foreach($old_que as $old_que_item_string) |
|
192 | 190 | { |
193 | - continue; |
|
194 | - } |
|
191 | + if(!$old_que_item_string) |
|
192 | + { |
|
193 | + continue; |
|
194 | + } |
|
195 | 195 | |
196 | - $old_que_item = explode(',', $old_que_item_string); |
|
197 | - if($old_que_item[4] == 'build') |
|
198 | - { |
|
199 | - $old_que_item[4] = BUILD_CREATE; |
|
200 | - } |
|
201 | - else |
|
202 | - { |
|
203 | - $old_que_item[4] = BUILD_DESTROY; |
|
204 | - } |
|
196 | + $old_que_item = explode(',', $old_que_item_string); |
|
197 | + if($old_que_item[4] == 'build') |
|
198 | + { |
|
199 | + $old_que_item[4] = BUILD_CREATE; |
|
200 | + } |
|
201 | + else |
|
202 | + { |
|
203 | + $old_que_item[4] = BUILD_DESTROY; |
|
204 | + } |
|
205 | 205 | |
206 | - $old_que_item[3] = $old_que_item[3] > $planet_data['last_update'] ? $old_que_item[3] - $planet_data['last_update'] : 1; |
|
207 | - $planet_data['que'] = "{$old_que_item[0]},1,{$old_que_item[3]},{$old_que_item[4]},{$const_que_structures};{$planet_data['que']}"; |
|
206 | + $old_que_item[3] = $old_que_item[3] > $planet_data['last_update'] ? $old_que_item[3] - $planet_data['last_update'] : 1; |
|
207 | + $planet_data['que'] = "{$old_que_item[0]},1,{$old_que_item[3]},{$old_que_item[4]},{$const_que_structures};{$planet_data['que']}"; |
|
208 | + } |
|
209 | + upd_do_query("UPDATE {{planets}} SET `que` = '{$planet_data['que']}', `b_building` = '0', `b_building_id` = '0' WHERE `id` = '{$planet_data['id']}' LIMIT 1;", true); |
|
208 | 210 | } |
209 | - upd_do_query("UPDATE {{planets}} SET `que` = '{$planet_data['que']}', `b_building` = '0', `b_building_id` = '0' WHERE `id` = '{$planet_data['id']}' LIMIT 1;", true); |
|
210 | 211 | } |
211 | - } |
|
212 | 212 | |
213 | - upd_do_query('COMMIT;', true); |
|
214 | - $new_version = 23; |
|
213 | + upd_do_query('COMMIT;', true); |
|
214 | + $new_version = 23; |
|
215 | 215 | |
216 | - case 23: |
|
217 | - case 24: |
|
218 | - upd_log_version_update(); |
|
216 | + case 23: |
|
217 | + case 24: |
|
218 | + upd_log_version_update(); |
|
219 | 219 | |
220 | - upd_create_table('confirmations', |
|
221 | - "( |
|
220 | + upd_create_table('confirmations', |
|
221 | + "( |
|
222 | 222 | `id` bigint(11) NOT NULL AUTO_INCREMENT, |
223 | 223 | `id_user` bigint(11) NOT NULL DEFAULT 0, |
224 | 224 | `type` SMALLINT NOT NULL DEFAULT 0, |
@@ -228,130 +228,130 @@ discard block |
||
228 | 228 | PRIMARY KEY (`id`), |
229 | 229 | KEY `i_code_email` (`code`, `email`) |
230 | 230 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
231 | - ); |
|
231 | + ); |
|
232 | 232 | |
233 | - if($update_tables['users']['urlaubs_until']) |
|
234 | - { |
|
235 | - upd_alter_table('users', "ADD `vacation` int(11) NOT NULL DEFAULT '0' COMMENT 'Time when user can leave vacation mode'", !$update_tables['users']['vacation']); |
|
236 | - upd_do_query('UPDATE {{users}} SET `vacation` = `urlaubs_until` WHERE `urlaubs_modus` <> 0;'); |
|
237 | - upd_alter_table('users', 'DROP COLUMN `urlaubs_until`, DROP COLUMN `urlaubs_modus`, DROP COLUMN `urlaubs_modus_time`', $update_tables['users']['urlaubs_until']); |
|
238 | - } |
|
233 | + if($update_tables['users']['urlaubs_until']) |
|
234 | + { |
|
235 | + upd_alter_table('users', "ADD `vacation` int(11) NOT NULL DEFAULT '0' COMMENT 'Time when user can leave vacation mode'", !$update_tables['users']['vacation']); |
|
236 | + upd_do_query('UPDATE {{users}} SET `vacation` = `urlaubs_until` WHERE `urlaubs_modus` <> 0;'); |
|
237 | + upd_alter_table('users', 'DROP COLUMN `urlaubs_until`, DROP COLUMN `urlaubs_modus`, DROP COLUMN `urlaubs_modus_time`', $update_tables['users']['urlaubs_until']); |
|
238 | + } |
|
239 | 239 | |
240 | - upd_check_key('user_vacation_disable', $config->urlaubs_modus_erz, !isset($config->user_vacation_disable)); |
|
241 | - upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('urlaubs_modus_erz');"); |
|
240 | + upd_check_key('user_vacation_disable', $config->urlaubs_modus_erz, !isset($config->user_vacation_disable)); |
|
241 | + upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('urlaubs_modus_erz');"); |
|
242 | 242 | |
243 | - upd_do_query('COMMIT;', true); |
|
244 | - $new_version = 25; |
|
245 | - |
|
246 | - case 25: |
|
247 | - upd_log_version_update(); |
|
248 | - |
|
249 | - upd_alter_table('rw', array( |
|
250 | - "DROP COLUMN `a_zestrzelona`", |
|
251 | - "DROP INDEX `rid`", |
|
252 | - "ADD COLUMN `report_id` bigint(11) NOT NULL AUTO_INCREMENT FIRST", |
|
253 | - "ADD PRIMARY KEY (`report_id`)", |
|
254 | - "ADD INDEX `i_rid` (`rid`)" |
|
255 | - ), !$update_tables['rw']['report_id']); |
|
256 | - |
|
257 | - upd_add_more_time(); |
|
258 | - upd_create_table('logs_backup', "AS (SELECT * FROM {$config->db_prefix}logs);"); |
|
259 | - |
|
260 | - upd_alter_table('logs', array( |
|
261 | - "MODIFY COLUMN `log_id` INT(1)", |
|
262 | - "DROP PRIMARY KEY" |
|
263 | - ), !$update_tables['logs']['log_timestamp']); |
|
264 | - |
|
265 | - upd_alter_table('logs', array( |
|
266 | - "DROP COLUMN `log_id`", |
|
267 | - "ADD COLUMN `log_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Human-readable record timestamp' FIRST", |
|
268 | - "ADD COLUMN `log_username` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'Username' AFTER `log_timestamp`", |
|
269 | - "MODIFY COLUMN `log_title` VARCHAR(64) NOT NULL DEFAULT 'Log entry' COMMENT 'Short description' AFTER `log_username`", |
|
270 | - "MODIFY COLUMN `log_page` VARCHAR(512) NOT NULL DEFAULT '' COMMENT 'Page that makes entry to log' AFTER `log_text`", |
|
271 | - "CHANGE COLUMN `log_type` `log_code` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `log_page`", |
|
272 | - "MODIFY COLUMN `log_sender` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'User ID which make log record' AFTER `log_code`", |
|
273 | - "MODIFY COLUMN `log_time` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Machine-readable timestamp' AFTER `log_sender`", |
|
274 | - "ADD COLUMN `log_dump` TEXT NOT NULL DEFAULT '' COMMENT 'Machine-readable dump of variables' AFTER `log_time`", |
|
275 | - "ADD INDEX `i_log_username` (`log_username`)", |
|
276 | - "ADD INDEX `i_log_time` (`log_time`)", |
|
277 | - "ADD INDEX `i_log_sender` (`log_sender`)", |
|
278 | - "ADD INDEX `i_log_code` (`log_code`)", |
|
279 | - "ADD INDEX `i_log_page` (`log_page`)", |
|
280 | - "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" |
|
281 | - ), !$update_tables['logs']['log_timestamp']); |
|
282 | - upd_do_query('DELETE FROM `{{logs}}` WHERE `log_code` = 303;'); |
|
283 | - |
|
284 | - if($update_tables['errors']) |
|
285 | - { |
|
286 | - upd_do_query('INSERT INTO `{{logs}}` (`log_code`, `log_sender`, `log_title`, `log_text`, `log_page`, `log_time`) SELECT 500, `error_sender`, `error_type`, `error_text`, `error_page`, `error_time` FROM `{{errors}}`;'); |
|
287 | - if($update_tables['errors_backup']) |
|
243 | + upd_do_query('COMMIT;', true); |
|
244 | + $new_version = 25; |
|
245 | + |
|
246 | + case 25: |
|
247 | + upd_log_version_update(); |
|
248 | + |
|
249 | + upd_alter_table('rw', array( |
|
250 | + "DROP COLUMN `a_zestrzelona`", |
|
251 | + "DROP INDEX `rid`", |
|
252 | + "ADD COLUMN `report_id` bigint(11) NOT NULL AUTO_INCREMENT FIRST", |
|
253 | + "ADD PRIMARY KEY (`report_id`)", |
|
254 | + "ADD INDEX `i_rid` (`rid`)" |
|
255 | + ), !$update_tables['rw']['report_id']); |
|
256 | + |
|
257 | + upd_add_more_time(); |
|
258 | + upd_create_table('logs_backup', "AS (SELECT * FROM {$config->db_prefix}logs);"); |
|
259 | + |
|
260 | + upd_alter_table('logs', array( |
|
261 | + "MODIFY COLUMN `log_id` INT(1)", |
|
262 | + "DROP PRIMARY KEY" |
|
263 | + ), !$update_tables['logs']['log_timestamp']); |
|
264 | + |
|
265 | + upd_alter_table('logs', array( |
|
266 | + "DROP COLUMN `log_id`", |
|
267 | + "ADD COLUMN `log_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Human-readable record timestamp' FIRST", |
|
268 | + "ADD COLUMN `log_username` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'Username' AFTER `log_timestamp`", |
|
269 | + "MODIFY COLUMN `log_title` VARCHAR(64) NOT NULL DEFAULT 'Log entry' COMMENT 'Short description' AFTER `log_username`", |
|
270 | + "MODIFY COLUMN `log_page` VARCHAR(512) NOT NULL DEFAULT '' COMMENT 'Page that makes entry to log' AFTER `log_text`", |
|
271 | + "CHANGE COLUMN `log_type` `log_code` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `log_page`", |
|
272 | + "MODIFY COLUMN `log_sender` BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'User ID which make log record' AFTER `log_code`", |
|
273 | + "MODIFY COLUMN `log_time` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Machine-readable timestamp' AFTER `log_sender`", |
|
274 | + "ADD COLUMN `log_dump` TEXT NOT NULL DEFAULT '' COMMENT 'Machine-readable dump of variables' AFTER `log_time`", |
|
275 | + "ADD INDEX `i_log_username` (`log_username`)", |
|
276 | + "ADD INDEX `i_log_time` (`log_time`)", |
|
277 | + "ADD INDEX `i_log_sender` (`log_sender`)", |
|
278 | + "ADD INDEX `i_log_code` (`log_code`)", |
|
279 | + "ADD INDEX `i_log_page` (`log_page`)", |
|
280 | + "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci" |
|
281 | + ), !$update_tables['logs']['log_timestamp']); |
|
282 | + upd_do_query('DELETE FROM `{{logs}}` WHERE `log_code` = 303;'); |
|
283 | + |
|
284 | + if($update_tables['errors']) |
|
288 | 285 | { |
289 | - upd_drop_table('errors_backup'); |
|
290 | - } |
|
291 | -// __db_query("ALTER TABLE {$config->db_prefix}errors RENAME TO {$config->db_prefix}errors_backup;"); |
|
292 | -// classSupernova::$db->__db_query("ALTER TABLE {$config->db_prefix}errors RENAME TO {$config->db_prefix}errors_backup;"); |
|
293 | - upd_alter_table('errors', ' RENAME TO {$config->db_prefix}errors_backup'); |
|
286 | + upd_do_query('INSERT INTO `{{logs}}` (`log_code`, `log_sender`, `log_title`, `log_text`, `log_page`, `log_time`) SELECT 500, `error_sender`, `error_type`, `error_text`, `error_page`, `error_time` FROM `{{errors}}`;'); |
|
287 | + if($update_tables['errors_backup']) |
|
288 | + { |
|
289 | + upd_drop_table('errors_backup'); |
|
290 | + } |
|
291 | + // __db_query("ALTER TABLE {$config->db_prefix}errors RENAME TO {$config->db_prefix}errors_backup;"); |
|
292 | + // classSupernova::$db->__db_query("ALTER TABLE {$config->db_prefix}errors RENAME TO {$config->db_prefix}errors_backup;"); |
|
293 | + upd_alter_table('errors', ' RENAME TO {$config->db_prefix}errors_backup'); |
|
294 | 294 | |
295 | - upd_drop_table('errors'); |
|
296 | - } |
|
295 | + upd_drop_table('errors'); |
|
296 | + } |
|
297 | 297 | |
298 | - upd_alter_table('logs', 'ORDER BY log_time'); |
|
298 | + upd_alter_table('logs', 'ORDER BY log_time'); |
|
299 | 299 | |
300 | - upd_alter_table('logs', array("ADD COLUMN `log_id` SERIAL", "ADD PRIMARY KEY (`log_id`)"), !$update_tables['logs']['log_id']); |
|
300 | + upd_alter_table('logs', array("ADD COLUMN `log_id` SERIAL", "ADD PRIMARY KEY (`log_id`)"), !$update_tables['logs']['log_id']); |
|
301 | 301 | |
302 | - upd_do_query('UPDATE `{{logs}}` SET `log_timestamp` = FROM_UNIXTIME(`log_time`);'); |
|
303 | - upd_do_query('UPDATE `{{logs}}` AS l LEFT JOIN `{{users}}` AS u ON u.id = l.log_sender SET l.log_username = u.username WHERE l.log_username IS NOT NULL;'); |
|
302 | + upd_do_query('UPDATE `{{logs}}` SET `log_timestamp` = FROM_UNIXTIME(`log_time`);'); |
|
303 | + upd_do_query('UPDATE `{{logs}}` AS l LEFT JOIN `{{users}}` AS u ON u.id = l.log_sender SET l.log_username = u.username WHERE l.log_username IS NOT NULL;'); |
|
304 | 304 | |
305 | - upd_do_query("UPDATE `{{logs}}` SET `log_code` = 190 WHERE `log_code` = 100 AND `log_title` = 'Stat update';"); |
|
306 | - upd_do_query("UPDATE `{{logs}}` SET `log_code` = 191 WHERE `log_code` = 101 AND `log_title` = 'Stat update';"); |
|
307 | - upd_do_query("UPDATE `{{logs}}` SET `log_code` = 192 WHERE `log_code` = 102 AND `log_title` = 'Stat update';"); |
|
308 | - $sys_log_disabled = false; |
|
305 | + upd_do_query("UPDATE `{{logs}}` SET `log_code` = 190 WHERE `log_code` = 100 AND `log_title` = 'Stat update';"); |
|
306 | + upd_do_query("UPDATE `{{logs}}` SET `log_code` = 191 WHERE `log_code` = 101 AND `log_title` = 'Stat update';"); |
|
307 | + upd_do_query("UPDATE `{{logs}}` SET `log_code` = 192 WHERE `log_code` = 102 AND `log_title` = 'Stat update';"); |
|
308 | + $sys_log_disabled = false; |
|
309 | 309 | |
310 | - upd_do_query('COMMIT;', true); |
|
311 | - $new_version = 26; |
|
310 | + upd_do_query('COMMIT;', true); |
|
311 | + $new_version = 26; |
|
312 | 312 | |
313 | - case 26: |
|
314 | - upd_log_version_update(); |
|
313 | + case 26: |
|
314 | + upd_log_version_update(); |
|
315 | 315 | |
316 | - $sys_log_disabled = false; |
|
316 | + $sys_log_disabled = false; |
|
317 | 317 | |
318 | - upd_alter_table('planets', "ADD INDEX `i_parent_planet` (`parent_planet`)", !$update_indexes['planets']['i_parent_planet']); |
|
319 | - upd_alter_table('messages', "DROP INDEX `owner`", $update_indexes['messages']['owner']); |
|
320 | - upd_alter_table('messages', "DROP INDEX `owner_type`", $update_indexes['messages']['owner_type']); |
|
321 | - upd_alter_table('messages', "DROP INDEX `sender_type`", $update_indexes['messages']['sender_type']); |
|
318 | + upd_alter_table('planets', "ADD INDEX `i_parent_planet` (`parent_planet`)", !$update_indexes['planets']['i_parent_planet']); |
|
319 | + upd_alter_table('messages', "DROP INDEX `owner`", $update_indexes['messages']['owner']); |
|
320 | + upd_alter_table('messages', "DROP INDEX `owner_type`", $update_indexes['messages']['owner_type']); |
|
321 | + upd_alter_table('messages', "DROP INDEX `sender_type`", $update_indexes['messages']['sender_type']); |
|
322 | 322 | |
323 | - upd_alter_table('messages', array( |
|
324 | - "ADD INDEX `i_owner_time` (`message_owner`, `message_time`)", |
|
325 | - "ADD INDEX `i_sender_time` (`message_sender`, `message_time`)", |
|
326 | - "ADD INDEX `i_time` (`message_time`)" |
|
327 | - ), !$update_indexes['messages']['i_owner_time']); |
|
323 | + upd_alter_table('messages', array( |
|
324 | + "ADD INDEX `i_owner_time` (`message_owner`, `message_time`)", |
|
325 | + "ADD INDEX `i_sender_time` (`message_sender`, `message_time`)", |
|
326 | + "ADD INDEX `i_time` (`message_time`)" |
|
327 | + ), !$update_indexes['messages']['i_owner_time']); |
|
328 | 328 | |
329 | - upd_drop_table('fleet_log'); |
|
329 | + upd_drop_table('fleet_log'); |
|
330 | 330 | |
331 | - upd_do_query("UPDATE `{{planets}}` SET `metal` = 0 WHERE `metal` < 0;"); |
|
332 | - upd_do_query("UPDATE `{{planets}}` SET `crystal` = 0 WHERE `crystal` < 0;"); |
|
333 | - upd_do_query("UPDATE `{{planets}}` SET `deuterium` = 0 WHERE `deuterium` < 0;"); |
|
334 | - upd_alter_table('planets', array( |
|
335 | - "DROP COLUMN `b_building`", |
|
336 | - "DROP COLUMN `b_building_id`" |
|
337 | - ), $update_tables['planets']['b_building']); |
|
331 | + upd_do_query("UPDATE `{{planets}}` SET `metal` = 0 WHERE `metal` < 0;"); |
|
332 | + upd_do_query("UPDATE `{{planets}}` SET `crystal` = 0 WHERE `crystal` < 0;"); |
|
333 | + upd_do_query("UPDATE `{{planets}}` SET `deuterium` = 0 WHERE `deuterium` < 0;"); |
|
334 | + upd_alter_table('planets', array( |
|
335 | + "DROP COLUMN `b_building`", |
|
336 | + "DROP COLUMN `b_building_id`" |
|
337 | + ), $update_tables['planets']['b_building']); |
|
338 | 338 | |
339 | - upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('noobprotection', 'noobprotectionmulti', 'noobprotectiontime', 'chat_admin_msgFormat');"); |
|
339 | + upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('noobprotection', 'noobprotectionmulti', 'noobprotectiontime', 'chat_admin_msgFormat');"); |
|
340 | 340 | |
341 | - upd_do_query("DELETE FROM `{{logs}}` WHERE `log_code` = 501;"); |
|
342 | - upd_do_query("DELETE FROM `{{logs}}` WHERE `log_title` IN ('Canceling Hangar Que', 'Building Planet Defense');"); |
|
341 | + upd_do_query("DELETE FROM `{{logs}}` WHERE `log_code` = 501;"); |
|
342 | + upd_do_query("DELETE FROM `{{logs}}` WHERE `log_title` IN ('Canceling Hangar Que', 'Building Planet Defense');"); |
|
343 | 343 | |
344 | - upd_check_key('chat_admin_highlight', '<font color=purple>$1</font>', !isset($config->chat_admin_highlight)); |
|
344 | + upd_check_key('chat_admin_highlight', '<font color=purple>$1</font>', !isset($config->chat_admin_highlight)); |
|
345 | 345 | |
346 | - upd_check_key('int_banner_URL', 'banner.php?type=banner', $config->int_banner_URL == '/banner.php?type=banner'); |
|
347 | - upd_check_key('int_userbar_URL', 'banner.php?type=userbar', $config->int_userbar_URL == '/banner.php?type=userbar'); |
|
346 | + upd_check_key('int_banner_URL', 'banner.php?type=banner', $config->int_banner_URL == '/banner.php?type=banner'); |
|
347 | + upd_check_key('int_userbar_URL', 'banner.php?type=userbar', $config->int_userbar_URL == '/banner.php?type=userbar'); |
|
348 | 348 | |
349 | - upd_alter_table('users', 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|
349 | + upd_alter_table('users', 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'); |
|
350 | 350 | |
351 | - if(!$update_tables['shortcut']) |
|
352 | - { |
|
353 | - upd_create_table('shortcut', |
|
354 | - "( |
|
351 | + if(!$update_tables['shortcut']) |
|
352 | + { |
|
353 | + upd_create_table('shortcut', |
|
354 | + "( |
|
355 | 355 | `shortcut_id` SERIAL, |
356 | 356 | `shortcut_user_id` BIGINT(11) UNSIGNED NOT NULL DEFAULT 0, |
357 | 357 | `shortcut_planet_id` bigint(11) NOT NULL DEFAULT 0, |
@@ -368,75 +368,75 @@ discard block |
||
368 | 368 | CONSTRAINT `FK_shortcut_user_id` FOREIGN KEY (`shortcut_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
369 | 369 | |
370 | 370 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
371 | - ); |
|
371 | + ); |
|
372 | 372 | |
373 | - $temp_planet_types = array(PT_PLANET, PT_DEBRIS, PT_MOON); |
|
373 | + $temp_planet_types = array(PT_PLANET, PT_DEBRIS, PT_MOON); |
|
374 | 374 | |
375 | - $query = upd_do_query("SELECT id, fleet_shortcut FROM {{users}} WHERE fleet_shortcut > '';"); |
|
376 | - while($user_data = db_fetch($query)) |
|
377 | - { |
|
378 | - $shortcuts = explode("\r\n", $user_data['fleet_shortcut']); |
|
379 | - foreach($shortcuts as $shortcut) |
|
375 | + $query = upd_do_query("SELECT id, fleet_shortcut FROM {{users}} WHERE fleet_shortcut > '';"); |
|
376 | + while($user_data = db_fetch($query)) |
|
380 | 377 | { |
381 | - if(!$shortcut) |
|
378 | + $shortcuts = explode("\r\n", $user_data['fleet_shortcut']); |
|
379 | + foreach($shortcuts as $shortcut) |
|
382 | 380 | { |
383 | - continue; |
|
384 | - } |
|
381 | + if(!$shortcut) |
|
382 | + { |
|
383 | + continue; |
|
384 | + } |
|
385 | 385 | |
386 | - $shortcut = explode(',', $shortcut); |
|
387 | - $shortcut[0] = db_escape($shortcut[0]); |
|
388 | - $shortcut[1] = intval($shortcut[1]); |
|
389 | - $shortcut[2] = intval($shortcut[2]); |
|
390 | - $shortcut[3] = intval($shortcut[3]); |
|
391 | - $shortcut[4] = intval($shortcut[4]); |
|
386 | + $shortcut = explode(',', $shortcut); |
|
387 | + $shortcut[0] = db_escape($shortcut[0]); |
|
388 | + $shortcut[1] = intval($shortcut[1]); |
|
389 | + $shortcut[2] = intval($shortcut[2]); |
|
390 | + $shortcut[3] = intval($shortcut[3]); |
|
391 | + $shortcut[4] = intval($shortcut[4]); |
|
392 | 392 | |
393 | - if($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) |
|
394 | - { |
|
395 | - upd_do_query("INSERT INTO {$config->db_prefix}shortcut (shortcut_user_id, shortcut_galaxy, shortcut_system, shortcut_planet, shortcut_planet_type, shortcut_text) VALUES ({$user_data['id']}, {$shortcut[1]}, {$shortcut[2]}, {$shortcut[3]}, {$shortcut[4]}, '{$shortcut[0]}');", true); |
|
393 | + if($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) |
|
394 | + { |
|
395 | + upd_do_query("INSERT INTO {$config->db_prefix}shortcut (shortcut_user_id, shortcut_galaxy, shortcut_system, shortcut_planet, shortcut_planet_type, shortcut_text) VALUES ({$user_data['id']}, {$shortcut[1]}, {$shortcut[2]}, {$shortcut[3]}, {$shortcut[4]}, '{$shortcut[0]}');", true); |
|
396 | + } |
|
396 | 397 | } |
397 | 398 | } |
398 | - } |
|
399 | 399 | |
400 | - upd_alter_table('users', 'DROP COLUMN `fleet_shortcut`'); |
|
401 | - }; |
|
400 | + upd_alter_table('users', 'DROP COLUMN `fleet_shortcut`'); |
|
401 | + }; |
|
402 | 402 | |
403 | - upd_check_key('url_faq', '', !isset($config->url_faq)); |
|
403 | + upd_check_key('url_faq', '', !isset($config->url_faq)); |
|
404 | 404 | |
405 | - upd_do_query('COMMIT;', true); |
|
406 | - $new_version = 27; |
|
407 | - |
|
408 | - case 27: |
|
409 | - upd_log_version_update(); |
|
410 | - |
|
411 | - upd_check_key('chat_highlight_moderator', '<font color=green>$1</font>', !isset($config->chat_highlight_moderator)); |
|
412 | - upd_check_key('chat_highlight_operator', '<font color=red>$1</font>', !isset($config->chat_highlight_operator)); |
|
413 | - upd_check_key('chat_highlight_admin', $config->chat_admin_highlight ? $config->chat_admin_highlight : '<font color=puple>$1</font>', !isset($config->chat_highlight_admin)); |
|
414 | - |
|
415 | - upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('chat_admin_highlight');"); |
|
416 | - |
|
417 | - upd_alter_table('banned', array( |
|
418 | - "CHANGE COLUMN id ban_id bigint(20) unsigned NOT NULL AUTO_INCREMENT", |
|
419 | - "CHANGE COLUMN `who` `ban_user_name` VARCHAR(64) NOT NULL DEFAULT ''", |
|
420 | - "CHANGE COLUMN `theme` `ban_reason` VARCHAR(128) NOT NULL DEFAULT ''", |
|
421 | - "CHANGE COLUMN `time` `ban_time` int(11) NOT NULL DEFAULT 0", |
|
422 | - "CHANGE COLUMN `longer` `ban_until` int(11) NOT NULL DEFAULT 0", |
|
423 | - "CHANGE COLUMN `author` `ban_issuer_name` VARCHAR(64) NOT NULL DEFAULT ''", |
|
424 | - "CHANGE COLUMN `email` `ban_issuer_email` VARCHAR(64) NOT NULL DEFAULT ''", |
|
425 | - "DROP COLUMN who2", |
|
426 | - "ADD PRIMARY KEY (`ban_id`)"/*, |
|
405 | + upd_do_query('COMMIT;', true); |
|
406 | + $new_version = 27; |
|
407 | + |
|
408 | + case 27: |
|
409 | + upd_log_version_update(); |
|
410 | + |
|
411 | + upd_check_key('chat_highlight_moderator', '<font color=green>$1</font>', !isset($config->chat_highlight_moderator)); |
|
412 | + upd_check_key('chat_highlight_operator', '<font color=red>$1</font>', !isset($config->chat_highlight_operator)); |
|
413 | + upd_check_key('chat_highlight_admin', $config->chat_admin_highlight ? $config->chat_admin_highlight : '<font color=puple>$1</font>', !isset($config->chat_highlight_admin)); |
|
414 | + |
|
415 | + upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('chat_admin_highlight');"); |
|
416 | + |
|
417 | + upd_alter_table('banned', array( |
|
418 | + "CHANGE COLUMN id ban_id bigint(20) unsigned NOT NULL AUTO_INCREMENT", |
|
419 | + "CHANGE COLUMN `who` `ban_user_name` VARCHAR(64) NOT NULL DEFAULT ''", |
|
420 | + "CHANGE COLUMN `theme` `ban_reason` VARCHAR(128) NOT NULL DEFAULT ''", |
|
421 | + "CHANGE COLUMN `time` `ban_time` int(11) NOT NULL DEFAULT 0", |
|
422 | + "CHANGE COLUMN `longer` `ban_until` int(11) NOT NULL DEFAULT 0", |
|
423 | + "CHANGE COLUMN `author` `ban_issuer_name` VARCHAR(64) NOT NULL DEFAULT ''", |
|
424 | + "CHANGE COLUMN `email` `ban_issuer_email` VARCHAR(64) NOT NULL DEFAULT ''", |
|
425 | + "DROP COLUMN who2", |
|
426 | + "ADD PRIMARY KEY (`ban_id`)"/*, |
|
427 | 427 | "RENAME TO {$config->db_prefix}ban"*/ |
428 | - ), !$update_tables['banned']['ban_id']); |
|
429 | - |
|
430 | - upd_alter_table('alliance', array( |
|
431 | - "MODIFY COLUMN `id` SERIAL", |
|
432 | - "ADD CONSTRAINT UNIQUE KEY `i_ally_name` (`ally_name`)", |
|
433 | - "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", |
|
434 | - "ENGINE=InnoDB" |
|
435 | - ), !$update_indexes['alliance']['i_ally_name']); |
|
436 | - |
|
437 | - $upd_relation_types = "'neutral', 'war', 'peace', 'confederation', 'federation', 'union', 'master', 'slave'"; |
|
438 | - upd_create_table('alliance_diplomacy', |
|
439 | - "( |
|
428 | + ), !$update_tables['banned']['ban_id']); |
|
429 | + |
|
430 | + upd_alter_table('alliance', array( |
|
431 | + "MODIFY COLUMN `id` SERIAL", |
|
432 | + "ADD CONSTRAINT UNIQUE KEY `i_ally_name` (`ally_name`)", |
|
433 | + "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci", |
|
434 | + "ENGINE=InnoDB" |
|
435 | + ), !$update_indexes['alliance']['i_ally_name']); |
|
436 | + |
|
437 | + $upd_relation_types = "'neutral', 'war', 'peace', 'confederation', 'federation', 'union', 'master', 'slave'"; |
|
438 | + upd_create_table('alliance_diplomacy', |
|
439 | + "( |
|
440 | 440 | `alliance_diplomacy_id` SERIAL, |
441 | 441 | `alliance_diplomacy_ally_id` bigint(11) UNSIGNED DEFAULT NULL, |
442 | 442 | `alliance_diplomacy_contr_ally_id` bigint(11) UNSIGNED DEFAULT NULL, |
@@ -453,10 +453,10 @@ discard block |
||
453 | 453 | ,CONSTRAINT `FK_diplomacy_contr_ally_id` FOREIGN KEY (`alliance_diplomacy_contr_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
454 | 454 | ,CONSTRAINT `FK_diplomacy_contr_ally_name` FOREIGN KEY (`alliance_diplomacy_contr_ally_name`) REFERENCES `{$config->db_prefix}alliance` (`ally_name`) ON DELETE CASCADE ON UPDATE CASCADE |
455 | 455 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;" |
456 | - ); |
|
456 | + ); |
|
457 | 457 | |
458 | - upd_create_table('alliance_negotiation', |
|
459 | - "( |
|
458 | + upd_create_table('alliance_negotiation', |
|
459 | + "( |
|
460 | 460 | `alliance_negotiation_id` SERIAL, |
461 | 461 | `alliance_negotiation_ally_id` bigint(11) UNSIGNED DEFAULT NULL, |
462 | 462 | `alliance_negotiation_ally_name` varchar(32) DEFAULT '', |
@@ -477,13 +477,13 @@ discard block |
||
477 | 477 | ,CONSTRAINT `FK_negotiation_contr_ally_id` FOREIGN KEY (`alliance_negotiation_contr_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
478 | 478 | ,CONSTRAINT `FK_negotiation_contr_ally_name` FOREIGN KEY (`alliance_negotiation_contr_ally_name`) REFERENCES `{$config->db_prefix}alliance` (`ally_name`) ON DELETE CASCADE ON UPDATE CASCADE |
479 | 479 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;" |
480 | - ); |
|
480 | + ); |
|
481 | 481 | |
482 | - upd_alter_table('users', array("MODIFY COLUMN `id` SERIAL", "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"), true); |
|
483 | - upd_alter_table('planets', array("MODIFY COLUMN `id` SERIAL", "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"), true); |
|
482 | + upd_alter_table('users', array("MODIFY COLUMN `id` SERIAL", "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"), true); |
|
483 | + upd_alter_table('planets', array("MODIFY COLUMN `id` SERIAL", "CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci"), true); |
|
484 | 484 | |
485 | - upd_create_table('bashing', |
|
486 | - "( |
|
485 | + upd_create_table('bashing', |
|
486 | + "( |
|
487 | 487 | `bashing_id` SERIAL, |
488 | 488 | `bashing_user_id` bigint(11) UNSIGNED DEFAULT NULL, |
489 | 489 | `bashing_planet_id` bigint(11) UNSIGNED DEFAULT NULL, |
@@ -497,23 +497,23 @@ discard block |
||
497 | 497 | CONSTRAINT `FK_bashing_user_id` FOREIGN KEY (`bashing_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
498 | 498 | ,CONSTRAINT `FK_bashing_planet_id` FOREIGN KEY (`bashing_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
499 | 499 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;" |
500 | - ); |
|
500 | + ); |
|
501 | 501 | |
502 | - upd_check_key('fleet_bashing_war_delay', 12 * 60 * 60, !isset($config->fleet_bashing_war_delay)); |
|
503 | - upd_check_key('fleet_bashing_scope', 24 * 60 * 60, !isset($config->fleet_bashing_scope)); |
|
504 | - upd_check_key('fleet_bashing_interval', 30 * 60, !isset($config->fleet_bashing_interval)); |
|
505 | - upd_check_key('fleet_bashing_waves', 3, !isset($config->fleet_bashing_waves)); |
|
506 | - upd_check_key('fleet_bashing_attacks', 3, !isset($config->fleet_bashing_attacks)); |
|
502 | + upd_check_key('fleet_bashing_war_delay', 12 * 60 * 60, !isset($config->fleet_bashing_war_delay)); |
|
503 | + upd_check_key('fleet_bashing_scope', 24 * 60 * 60, !isset($config->fleet_bashing_scope)); |
|
504 | + upd_check_key('fleet_bashing_interval', 30 * 60, !isset($config->fleet_bashing_interval)); |
|
505 | + upd_check_key('fleet_bashing_waves', 3, !isset($config->fleet_bashing_waves)); |
|
506 | + upd_check_key('fleet_bashing_attacks', 3, !isset($config->fleet_bashing_attacks)); |
|
507 | 507 | |
508 | - upd_do_query('COMMIT;', true); |
|
509 | - $new_version = 28; |
|
508 | + upd_do_query('COMMIT;', true); |
|
509 | + $new_version = 28; |
|
510 | 510 | |
511 | - case 28: |
|
512 | - case 28.1: |
|
513 | - upd_log_version_update(); |
|
511 | + case 28: |
|
512 | + case 28.1: |
|
513 | + upd_log_version_update(); |
|
514 | 514 | |
515 | - upd_create_table('quest', |
|
516 | - "( |
|
515 | + upd_create_table('quest', |
|
516 | + "( |
|
517 | 517 | `quest_id` SERIAL, |
518 | 518 | `quest_name` VARCHAR(255) DEFAULT NULL, |
519 | 519 | `quest_description` TEXT, |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | PRIMARY KEY (`quest_id`) |
526 | 526 | ,KEY (`quest_type`, `quest_order`) |
527 | 527 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;" |
528 | - ); |
|
528 | + ); |
|
529 | 529 | |
530 | - upd_create_table('quest_status', |
|
531 | - "( |
|
530 | + upd_create_table('quest_status', |
|
531 | + "( |
|
532 | 532 | `quest_status_id` SERIAL, |
533 | 533 | `quest_status_quest_id` bigint(20) UNSIGNED DEFAULT NULL, |
534 | 534 | `quest_status_user_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0', |
@@ -540,82 +540,82 @@ discard block |
||
540 | 540 | ,CONSTRAINT `FK_quest_status_quest_id` FOREIGN KEY (`quest_status_quest_id`) REFERENCES `{$config->db_prefix}quest` (`quest_id`) ON DELETE CASCADE ON UPDATE CASCADE |
541 | 541 | ,CONSTRAINT `FK_quest_status_user_id` FOREIGN KEY (`quest_status_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
542 | 542 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;" |
543 | - ); |
|
544 | - |
|
545 | - upd_check_key('quest_total', 0, !isset($config->quest_total)); |
|
546 | - |
|
547 | - for($i = 0; $i < 25; $i++) |
|
548 | - { |
|
549 | - upd_alter_table('alliance', array("DROP INDEX `id_{$i}`",), $update_indexes['alliance']["id_{$i}"]); |
|
550 | - upd_alter_table('users', array("DROP INDEX `id_{$i}`",), $update_indexes['users']["id_{$i}"]); |
|
551 | - upd_alter_table('planets', array("DROP INDEX `id_{$i}`",), $update_indexes['planets']["id_{$i}"]); |
|
552 | - } |
|
553 | - |
|
554 | - upd_alter_table('alliance', array('DROP INDEX `id`',), $update_indexes['alliance']['id']); |
|
555 | - upd_alter_table('alliance', array('DROP INDEX `ally_name`',), $update_indexes['alliance']['ally_name']); |
|
556 | - upd_alter_table('alliance', array('ADD UNIQUE INDEX `i_ally_tag` (`ally_tag`)',), !$update_indexes['alliance']['i_ally_tag']); |
|
557 | - upd_alter_table('alliance', array('MODIFY COLUMN `ranklist` TEXT',), true); |
|
543 | + ); |
|
558 | 544 | |
559 | - upd_alter_table('users', array('DROP INDEX `id`',), $update_indexes['users']['id']); |
|
560 | - upd_alter_table('users', "CHANGE COLUMN `rpg_points` `dark_matter` int(11) DEFAULT 0", $update_tables['users']['rpg_points']); |
|
545 | + upd_check_key('quest_total', 0, !isset($config->quest_total)); |
|
561 | 546 | |
562 | - upd_alter_table('users', array( |
|
563 | - 'DROP COLUMN `ally_request`', |
|
564 | - 'DROP COLUMN `ally_request_text`', |
|
565 | - ), $update_tables['users']['ally_request_text']); |
|
547 | + for($i = 0; $i < 25; $i++) |
|
548 | + { |
|
549 | + upd_alter_table('alliance', array("DROP INDEX `id_{$i}`",), $update_indexes['alliance']["id_{$i}"]); |
|
550 | + upd_alter_table('users', array("DROP INDEX `id_{$i}`",), $update_indexes['users']["id_{$i}"]); |
|
551 | + upd_alter_table('planets', array("DROP INDEX `id_{$i}`",), $update_indexes['planets']["id_{$i}"]); |
|
552 | + } |
|
566 | 553 | |
567 | - upd_alter_table('users', array( |
|
568 | - 'ADD INDEX `i_ally_id` (`ally_id`)', |
|
569 | - 'ADD INDEX `i_ally_name` (`ally_name`)', |
|
570 | - ), !$update_indexes['users']['i_ally_id']); |
|
554 | + upd_alter_table('alliance', array('DROP INDEX `id`',), $update_indexes['alliance']['id']); |
|
555 | + upd_alter_table('alliance', array('DROP INDEX `ally_name`',), $update_indexes['alliance']['ally_name']); |
|
556 | + upd_alter_table('alliance', array('ADD UNIQUE INDEX `i_ally_tag` (`ally_tag`)',), !$update_indexes['alliance']['i_ally_tag']); |
|
557 | + upd_alter_table('alliance', array('MODIFY COLUMN `ranklist` TEXT',), true); |
|
571 | 558 | |
572 | - upd_alter_table('users', array( |
|
573 | - "ADD `msg_admin` bigint(11) unsigned DEFAULT '0' AFTER mnl_buildlist" |
|
574 | - ), !$update_tables['users']['msg_admin']); |
|
559 | + upd_alter_table('users', array('DROP INDEX `id`',), $update_indexes['users']['id']); |
|
560 | + upd_alter_table('users', "CHANGE COLUMN `rpg_points` `dark_matter` int(11) DEFAULT 0", $update_tables['users']['rpg_points']); |
|
575 | 561 | |
576 | - if(!$update_foreigns['users']['FK_users_ally_id']) |
|
577 | - { |
|
578 | 562 | upd_alter_table('users', array( |
579 | - 'MODIFY COLUMN `ally_name` VARCHAR(32) DEFAULT NULL', |
|
580 | - 'MODIFY COLUMN `ally_id` BIGINT(20) UNSIGNED DEFAULT NULL', |
|
581 | - ), strtoupper($update_tables['users']['ally_id']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
563 | + 'DROP COLUMN `ally_request`', |
|
564 | + 'DROP COLUMN `ally_request_text`', |
|
565 | + ), $update_tables['users']['ally_request_text']); |
|
582 | 566 | |
583 | - upd_do_query('DELETE FROM {{alliance}} WHERE id not in (select ally_id from {{users}} group by ally_id);'); |
|
584 | - upd_do_query("UPDATE {{users}} SET `ally_id` = null, ally_name = null, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` NOT IN (SELECT id FROM {{alliance}});"); |
|
585 | - upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.ally_id = a.id SET u.ally_name = a.ally_name, u.ally_tag = a.ally_tag WHERE u.ally_id IS NOT NULL;"); |
|
567 | + upd_alter_table('users', array( |
|
568 | + 'ADD INDEX `i_ally_id` (`ally_id`)', |
|
569 | + 'ADD INDEX `i_ally_name` (`ally_name`)', |
|
570 | + ), !$update_indexes['users']['i_ally_id']); |
|
586 | 571 | |
587 | 572 | upd_alter_table('users', array( |
588 | - "ADD CONSTRAINT `FK_users_ally_id` FOREIGN KEY (`ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
589 | - "ADD CONSTRAINT `FK_users_ally_name` FOREIGN KEY (`ally_name`) REFERENCES `{$config->db_prefix}alliance` (`ally_name`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
590 | - ), !$update_foreigns['users']['FK_users_ally_id']); |
|
591 | - } |
|
573 | + "ADD `msg_admin` bigint(11) unsigned DEFAULT '0' AFTER mnl_buildlist" |
|
574 | + ), !$update_tables['users']['msg_admin']); |
|
592 | 575 | |
593 | - upd_alter_table('planets', array( |
|
594 | - "MODIFY COLUMN `debris_metal` BIGINT(20) UNSIGNED DEFAULT 0", |
|
595 | - "MODIFY COLUMN `debris_crystal` BIGINT(20) UNSIGNED DEFAULT 0", |
|
596 | - ), strtoupper($update_tables['planets']['debris_metal']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
576 | + if(!$update_foreigns['users']['FK_users_ally_id']) |
|
577 | + { |
|
578 | + upd_alter_table('users', array( |
|
579 | + 'MODIFY COLUMN `ally_name` VARCHAR(32) DEFAULT NULL', |
|
580 | + 'MODIFY COLUMN `ally_id` BIGINT(20) UNSIGNED DEFAULT NULL', |
|
581 | + ), strtoupper($update_tables['users']['ally_id']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
582 | + |
|
583 | + upd_do_query('DELETE FROM {{alliance}} WHERE id not in (select ally_id from {{users}} group by ally_id);'); |
|
584 | + upd_do_query("UPDATE {{users}} SET `ally_id` = null, ally_name = null, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` NOT IN (SELECT id FROM {{alliance}});"); |
|
585 | + upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.ally_id = a.id SET u.ally_name = a.ally_name, u.ally_tag = a.ally_tag WHERE u.ally_id IS NOT NULL;"); |
|
586 | + |
|
587 | + upd_alter_table('users', array( |
|
588 | + "ADD CONSTRAINT `FK_users_ally_id` FOREIGN KEY (`ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
589 | + "ADD CONSTRAINT `FK_users_ally_name` FOREIGN KEY (`ally_name`) REFERENCES `{$config->db_prefix}alliance` (`ally_name`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
590 | + ), !$update_foreigns['users']['FK_users_ally_id']); |
|
591 | + } |
|
597 | 592 | |
598 | - $illegal_moon_query = upd_do_query("SELECT id FROM `{{planets}}` WHERE `id_owner` <> 0 AND `planet_type` = 3 AND `parent_planet` <> 0 AND `parent_planet` NOT IN (SELECT `id` FROM {{planets}} WHERE `planet_type` = 1);"); |
|
599 | - while($illegal_moon_row = db_fetch($illegal_moon_query)) |
|
600 | - { |
|
601 | - upd_do_query("DELETE FROM {{planets}} WHERE id = {$illegal_moon_row['id']} LIMIT 1;", true); |
|
602 | - } |
|
593 | + upd_alter_table('planets', array( |
|
594 | + "MODIFY COLUMN `debris_metal` BIGINT(20) UNSIGNED DEFAULT 0", |
|
595 | + "MODIFY COLUMN `debris_crystal` BIGINT(20) UNSIGNED DEFAULT 0", |
|
596 | + ), strtoupper($update_tables['planets']['debris_metal']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
603 | 597 | |
604 | - upd_check_key('allow_buffing', isset($config->fleet_buffing_check) ? !$config->fleet_buffing_check : 0, !isset($config->allow_buffing)); |
|
605 | - upd_check_key('ally_help_weak', 0, !isset($config->ally_help_weak)); |
|
598 | + $illegal_moon_query = upd_do_query("SELECT id FROM `{{planets}}` WHERE `id_owner` <> 0 AND `planet_type` = 3 AND `parent_planet` <> 0 AND `parent_planet` NOT IN (SELECT `id` FROM {{planets}} WHERE `planet_type` = 1);"); |
|
599 | + while($illegal_moon_row = db_fetch($illegal_moon_query)) |
|
600 | + { |
|
601 | + upd_do_query("DELETE FROM {{planets}} WHERE id = {$illegal_moon_row['id']} LIMIT 1;", true); |
|
602 | + } |
|
606 | 603 | |
607 | - upd_do_query('COMMIT;', true); |
|
608 | - $new_version = 29; |
|
604 | + upd_check_key('allow_buffing', isset($config->fleet_buffing_check) ? !$config->fleet_buffing_check : 0, !isset($config->allow_buffing)); |
|
605 | + upd_check_key('ally_help_weak', 0, !isset($config->ally_help_weak)); |
|
606 | + |
|
607 | + upd_do_query('COMMIT;', true); |
|
608 | + $new_version = 29; |
|
609 | 609 | |
610 | - case 29: |
|
611 | - upd_log_version_update(); |
|
610 | + case 29: |
|
611 | + upd_log_version_update(); |
|
612 | 612 | |
613 | - upd_check_key('game_email_pm', 0, !isset($config->game_email_pm)); |
|
614 | - upd_check_key('player_vacation_time', 2*24*60*60, !isset($config->player_vacation_time)); |
|
615 | - upd_check_key('player_delete_time', 45*24*60*60, !isset($config->player_delete_time)); |
|
613 | + upd_check_key('game_email_pm', 0, !isset($config->game_email_pm)); |
|
614 | + upd_check_key('player_vacation_time', 2*24*60*60, !isset($config->player_vacation_time)); |
|
615 | + upd_check_key('player_delete_time', 45*24*60*60, !isset($config->player_delete_time)); |
|
616 | 616 | |
617 | - upd_create_table('log_dark_matter', |
|
618 | - "( |
|
617 | + upd_create_table('log_dark_matter', |
|
618 | + "( |
|
619 | 619 | `log_dark_matter_id` SERIAL, |
620 | 620 | `log_dark_matter_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Human-readable record timestamp', |
621 | 621 | `log_dark_matter_username` varchar(64) NOT NULL DEFAULT '' COMMENT 'Username', |
@@ -630,23 +630,23 @@ discard block |
||
630 | 630 | KEY `i_log_dark_matter_reason_sender_id` (`log_dark_matter_reason`, `log_dark_matter_sender`, `log_dark_matter_id`), |
631 | 631 | KEY `i_log_dark_matter_amount` (`log_dark_matter_amount`) |
632 | 632 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;" |
633 | - ); |
|
634 | - upd_do_query('COMMIT;', true); |
|
633 | + ); |
|
634 | + upd_do_query('COMMIT;', true); |
|
635 | 635 | |
636 | - $records = 1; |
|
637 | - while($records) |
|
638 | - { |
|
639 | - upd_do_query('START TRANSACTION;', true); |
|
640 | - $query = upd_do_query("SELECT * FROM {{logs}} WHERE log_code = 102 order by log_id LIMIT 1000;"); |
|
641 | - $records = db_num_rows($query); |
|
642 | - while($row = db_fetch($query)) |
|
636 | + $records = 1; |
|
637 | + while($records) |
|
643 | 638 | { |
644 | - $result = preg_match('/^Player ID (\d+) Dark Matter was adjusted with (\-?\d+). Reason: (.+)$/', $row['log_text'], $matches); |
|
645 | - |
|
646 | - $reason = RPG_NONE; |
|
647 | - $comment = $matches[3]; |
|
648 | - switch($matches[3]) |
|
639 | + upd_do_query('START TRANSACTION;', true); |
|
640 | + $query = upd_do_query("SELECT * FROM {{logs}} WHERE log_code = 102 order by log_id LIMIT 1000;"); |
|
641 | + $records = db_num_rows($query); |
|
642 | + while($row = db_fetch($query)) |
|
649 | 643 | { |
644 | + $result = preg_match('/^Player ID (\d+) Dark Matter was adjusted with (\-?\d+). Reason: (.+)$/', $row['log_text'], $matches); |
|
645 | + |
|
646 | + $reason = RPG_NONE; |
|
647 | + $comment = $matches[3]; |
|
648 | + switch($matches[3]) |
|
649 | + { |
|
650 | 650 | case 'Level Up For Structure Building': |
651 | 651 | $reason = RPG_STRUCTURE; |
652 | 652 | break; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $comment = $matches2[1]; |
683 | 683 | } |
684 | 684 | break; |
685 | - } |
|
685 | + } |
|
686 | 686 | |
687 | 687 | if($matches[2]) |
688 | 688 | { |
@@ -720,595 +720,595 @@ discard block |
||
720 | 720 | upd_do_query('COMMIT;', true); |
721 | 721 | $new_version = 30; |
722 | 722 | |
723 | - case 30: |
|
724 | - upd_log_version_update(); |
|
723 | + case 30: |
|
724 | + upd_log_version_update(); |
|
725 | 725 | |
726 | - upd_alter_table('users', array( |
|
727 | - "ADD `player_que` TEXT" |
|
728 | - ), !$update_tables['users']['player_que']); |
|
726 | + upd_alter_table('users', array( |
|
727 | + "ADD `player_que` TEXT" |
|
728 | + ), !$update_tables['users']['player_que']); |
|
729 | 729 | |
730 | - upd_alter_table('planets', array( |
|
731 | - "CHANGE COLUMN `governor` `PLANET_GOVERNOR_ID` SMALLINT(5) NOT NULL DEFAULT 0", |
|
732 | - "CHANGE COLUMN `governor_level` `PLANET_GOVERNOR_LEVEL` SMALLINT(5) NOT NULL DEFAULT 0", |
|
733 | - ), !$update_tables['planets']['PLANET_GOVERNOR_ID']); |
|
730 | + upd_alter_table('planets', array( |
|
731 | + "CHANGE COLUMN `governor` `PLANET_GOVERNOR_ID` SMALLINT(5) NOT NULL DEFAULT 0", |
|
732 | + "CHANGE COLUMN `governor_level` `PLANET_GOVERNOR_LEVEL` SMALLINT(5) NOT NULL DEFAULT 0", |
|
733 | + ), !$update_tables['planets']['PLANET_GOVERNOR_ID']); |
|
734 | 734 | |
735 | - if($update_tables['users']['rpg_geologue']) |
|
736 | - { |
|
737 | - doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_geologue` + `rpg_ingenieur` + `rpg_constructeur` + `rpg_technocrate` + `rpg_scientifique` + `rpg_defenseur`) * 3;"); |
|
735 | + if($update_tables['users']['rpg_geologue']) |
|
736 | + { |
|
737 | + doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_geologue` + `rpg_ingenieur` + `rpg_constructeur` + `rpg_technocrate` + `rpg_scientifique` + `rpg_defenseur`) * 3;"); |
|
738 | + |
|
739 | + upd_alter_table('users', array( |
|
740 | + "DROP COLUMN `rpg_geologue`", |
|
741 | + "DROP COLUMN `rpg_ingenieur`", |
|
742 | + "DROP COLUMN `rpg_constructeur`", |
|
743 | + "DROP COLUMN `rpg_technocrate`", |
|
744 | + "DROP COLUMN `rpg_scientifique`", |
|
745 | + "DROP COLUMN `rpg_defenseur`", |
|
746 | + ), $update_tables['users']['rpg_geologue']); |
|
747 | + } |
|
738 | 748 | |
739 | - upd_alter_table('users', array( |
|
740 | - "DROP COLUMN `rpg_geologue`", |
|
741 | - "DROP COLUMN `rpg_ingenieur`", |
|
742 | - "DROP COLUMN `rpg_constructeur`", |
|
743 | - "DROP COLUMN `rpg_technocrate`", |
|
744 | - "DROP COLUMN `rpg_scientifique`", |
|
745 | - "DROP COLUMN `rpg_defenseur`", |
|
746 | - ), $update_tables['users']['rpg_geologue']); |
|
747 | - } |
|
749 | + if($update_tables['users']['rpg_bunker']) |
|
750 | + { |
|
751 | + doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_bunker`) * 3;"); |
|
748 | 752 | |
749 | - if($update_tables['users']['rpg_bunker']) |
|
750 | - { |
|
751 | - doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_bunker`) * 3;"); |
|
753 | + upd_alter_table('users', array( |
|
754 | + "DROP COLUMN `rpg_bunker`", |
|
755 | + ), $update_tables['users']['rpg_bunker']); |
|
756 | + } |
|
752 | 757 | |
753 | 758 | upd_alter_table('users', array( |
754 | - "DROP COLUMN `rpg_bunker`", |
|
755 | - ), $update_tables['users']['rpg_bunker']); |
|
756 | - } |
|
759 | + "DROP COLUMN `p_infligees`", |
|
760 | + "MODIFY COLUMN `dark_matter` BIGINT(20) DEFAULT '0' AFTER `lvl_raid`", |
|
761 | + ), $update_tables['users']['p_infligees']); |
|
757 | 762 | |
758 | - upd_alter_table('users', array( |
|
759 | - "DROP COLUMN `p_infligees`", |
|
760 | - "MODIFY COLUMN `dark_matter` BIGINT(20) DEFAULT '0' AFTER `lvl_raid`", |
|
761 | - ), $update_tables['users']['p_infligees']); |
|
762 | - |
|
763 | - upd_alter_table('users', array( |
|
764 | - "ADD COLUMN `mrc_academic` SMALLINT(3) DEFAULT 0", |
|
765 | - ), !$update_tables['users']['mrc_academic']); |
|
766 | - |
|
767 | - upd_alter_table('users', array( |
|
768 | - "DROP COLUMN `db_deaktjava`", |
|
769 | - "DROP COLUMN `kolorminus`", |
|
770 | - "DROP COLUMN `kolorplus`", |
|
771 | - "DROP COLUMN `kolorpoziom`", |
|
772 | - "DROP COLUMN `deleteme`", |
|
773 | - |
|
774 | - "MODIFY COLUMN `xpraid` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
775 | - "MODIFY COLUMN `xpminier` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
776 | - "MODIFY COLUMN `raids` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
777 | - "MODIFY COLUMN `raidsloose` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
778 | - "MODIFY COLUMN `raidswin` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
779 | - |
|
780 | - "MODIFY COLUMN `register_time` INT(10) UNSIGNED DEFAULT '0'", |
|
781 | - "MODIFY COLUMN `onlinetime` INT(10) UNSIGNED DEFAULT '0'", |
|
782 | - "MODIFY COLUMN `news_lastread` INT(10) UNSIGNED DEFAULT '0'", |
|
783 | - "MODIFY COLUMN `deltime` INT(10) UNSIGNED DEFAULT '0'", |
|
784 | - "MODIFY COLUMN `banaday` INT(10) UNSIGNED DEFAULT '0'", |
|
785 | - "MODIFY COLUMN `vacation` INT(10) UNSIGNED DEFAULT '0'", |
|
786 | - ), strtoupper($update_tables['users']['xpraid']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
787 | - |
|
788 | - upd_alter_table('users', array( |
|
789 | - "ADD COLUMN `total_rank` INT(10) UNSIGNED NOT NULL DEFAULT 0", |
|
790 | - "ADD COLUMN `total_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0", |
|
791 | - ), !isset($update_tables['users']['total_rank'])); |
|
792 | - doquery("UPDATE {{users}} AS u JOIN {{statpoints}} AS sp ON sp.id_owner = u.id AND sp.stat_code = 1 AND sp.stat_type = 1 SET u.total_rank = sp.total_rank, u.total_points = sp.total_points;"); |
|
793 | - |
|
794 | - upd_alter_table('alliance', array( |
|
795 | - "ADD COLUMN `total_rank` INT(10) UNSIGNED NOT NULL DEFAULT 0", |
|
796 | - "ADD COLUMN `total_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0", |
|
797 | - ), !isset($update_tables['alliance']['total_rank'])); |
|
798 | - doquery("UPDATE {{alliance}} AS a JOIN {{statpoints}} AS sp ON sp.id_owner = a.id AND sp.stat_code = 1 AND sp.stat_type = 2 SET a.total_rank = sp.total_rank, a.total_points = sp.total_points;"); |
|
799 | - |
|
800 | - if(!isset($update_tables['users']['ally_tag'])) |
|
801 | - { |
|
802 | 763 | upd_alter_table('users', array( |
803 | - "ADD COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
|
804 | - ), !isset($update_tables['users']['ally_tag'])); |
|
805 | - doquery("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON a.id = u.ally_id SET u.ally_tag = a.ally_tag, u.ally_name = a.ally_name;"); |
|
806 | - doquery("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON a.id = u.ally_id SET u.ally_id = NULL, u.ally_tag = NULL, u.ally_name = NULL, u.ally_register_time = 0, ally_rank_id = 0 WHERE a.id is NULL;"); |
|
764 | + "ADD COLUMN `mrc_academic` SMALLINT(3) DEFAULT 0", |
|
765 | + ), !$update_tables['users']['mrc_academic']); |
|
766 | + |
|
807 | 767 | upd_alter_table('users', array( |
808 | - "ADD CONSTRAINT `FK_users_ally_tag` FOREIGN KEY (`ally_tag`) REFERENCES `{$config->db_prefix}alliance` (`ally_tag`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
809 | - ), !$update_foreigns['users']['FK_users_ally_tag']); |
|
810 | - } |
|
768 | + "DROP COLUMN `db_deaktjava`", |
|
769 | + "DROP COLUMN `kolorminus`", |
|
770 | + "DROP COLUMN `kolorplus`", |
|
771 | + "DROP COLUMN `kolorpoziom`", |
|
772 | + "DROP COLUMN `deleteme`", |
|
773 | + |
|
774 | + "MODIFY COLUMN `xpraid` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
775 | + "MODIFY COLUMN `xpminier` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
776 | + "MODIFY COLUMN `raids` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
777 | + "MODIFY COLUMN `raidsloose` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
778 | + "MODIFY COLUMN `raidswin` BIGINT(20) UNSIGNED DEFAULT '0'", |
|
779 | + |
|
780 | + "MODIFY COLUMN `register_time` INT(10) UNSIGNED DEFAULT '0'", |
|
781 | + "MODIFY COLUMN `onlinetime` INT(10) UNSIGNED DEFAULT '0'", |
|
782 | + "MODIFY COLUMN `news_lastread` INT(10) UNSIGNED DEFAULT '0'", |
|
783 | + "MODIFY COLUMN `deltime` INT(10) UNSIGNED DEFAULT '0'", |
|
784 | + "MODIFY COLUMN `banaday` INT(10) UNSIGNED DEFAULT '0'", |
|
785 | + "MODIFY COLUMN `vacation` INT(10) UNSIGNED DEFAULT '0'", |
|
786 | + ), strtoupper($update_tables['users']['xpraid']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
811 | 787 | |
812 | - upd_alter_table('users', array( |
|
813 | - "ADD COLUMN `player_artifact_list` TEXT", |
|
814 | - ), !isset($update_tables['users']['player_artifact_list'])); |
|
788 | + upd_alter_table('users', array( |
|
789 | + "ADD COLUMN `total_rank` INT(10) UNSIGNED NOT NULL DEFAULT 0", |
|
790 | + "ADD COLUMN `total_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0", |
|
791 | + ), !isset($update_tables['users']['total_rank'])); |
|
792 | + doquery("UPDATE {{users}} AS u JOIN {{statpoints}} AS sp ON sp.id_owner = u.id AND sp.stat_code = 1 AND sp.stat_type = 1 SET u.total_rank = sp.total_rank, u.total_points = sp.total_points;"); |
|
815 | 793 | |
816 | - if(!isset($update_tables['users']['player_rpg_tech_xp'])) |
|
817 | - { |
|
818 | - upd_check_key('eco_scale_storage', 1, !isset($config->eco_scale_storage)); |
|
794 | + upd_alter_table('alliance', array( |
|
795 | + "ADD COLUMN `total_rank` INT(10) UNSIGNED NOT NULL DEFAULT 0", |
|
796 | + "ADD COLUMN `total_points` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0", |
|
797 | + ), !isset($update_tables['alliance']['total_rank'])); |
|
798 | + doquery("UPDATE {{alliance}} AS a JOIN {{statpoints}} AS sp ON sp.id_owner = a.id AND sp.stat_code = 1 AND sp.stat_type = 2 SET a.total_rank = sp.total_rank, a.total_points = sp.total_points;"); |
|
799 | + |
|
800 | + if(!isset($update_tables['users']['ally_tag'])) |
|
801 | + { |
|
802 | + upd_alter_table('users', array( |
|
803 | + "ADD COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
|
804 | + ), !isset($update_tables['users']['ally_tag'])); |
|
805 | + doquery("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON a.id = u.ally_id SET u.ally_tag = a.ally_tag, u.ally_name = a.ally_name;"); |
|
806 | + doquery("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON a.id = u.ally_id SET u.ally_id = NULL, u.ally_tag = NULL, u.ally_name = NULL, u.ally_register_time = 0, ally_rank_id = 0 WHERE a.id is NULL;"); |
|
807 | + upd_alter_table('users', array( |
|
808 | + "ADD CONSTRAINT `FK_users_ally_tag` FOREIGN KEY (`ally_tag`) REFERENCES `{$config->db_prefix}alliance` (`ally_tag`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
809 | + ), !$update_foreigns['users']['FK_users_ally_tag']); |
|
810 | + } |
|
819 | 811 | |
820 | 812 | upd_alter_table('users', array( |
821 | - "ADD COLUMN `player_rpg_tech_level` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
|
822 | - "ADD COLUMN `player_rpg_tech_xp` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
|
823 | - ), !isset($update_tables['users']['player_rpg_tech_xp'])); |
|
813 | + "ADD COLUMN `player_artifact_list` TEXT", |
|
814 | + ), !isset($update_tables['users']['player_artifact_list'])); |
|
824 | 815 | |
825 | - doquery("UPDATE {{users}} AS u LEFT JOIN {{statpoints}} AS s ON s.id_owner = u.id AND s.stat_type = 1 AND s.stat_code = 1 SET u.player_rpg_tech_xp = s.tech_points;"); |
|
826 | - } |
|
816 | + if(!isset($update_tables['users']['player_rpg_tech_xp'])) |
|
817 | + { |
|
818 | + upd_check_key('eco_scale_storage', 1, !isset($config->eco_scale_storage)); |
|
827 | 819 | |
828 | - upd_alter_table('planets', array( |
|
829 | - "ADD COLUMN `planet_cargo_hyper` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `big_ship_cargo`", |
|
830 | - ), !isset($update_tables['planets']['planet_cargo_hyper'])); |
|
820 | + upd_alter_table('users', array( |
|
821 | + "ADD COLUMN `player_rpg_tech_level` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
|
822 | + "ADD COLUMN `player_rpg_tech_xp` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
|
823 | + ), !isset($update_tables['users']['player_rpg_tech_xp'])); |
|
831 | 824 | |
832 | - upd_do_query('COMMIT;', true); |
|
833 | - $new_version = 31; |
|
825 | + doquery("UPDATE {{users}} AS u LEFT JOIN {{statpoints}} AS s ON s.id_owner = u.id AND s.stat_type = 1 AND s.stat_code = 1 SET u.player_rpg_tech_xp = s.tech_points;"); |
|
826 | + } |
|
834 | 827 | |
835 | - case 31: |
|
836 | - upd_log_version_update(); |
|
828 | + upd_alter_table('planets', array( |
|
829 | + "ADD COLUMN `planet_cargo_hyper` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `big_ship_cargo`", |
|
830 | + ), !isset($update_tables['planets']['planet_cargo_hyper'])); |
|
837 | 831 | |
838 | - upd_alter_table('aks', array( |
|
839 | - "MODIFY COLUMN `planet_type` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", |
|
840 | - ), strtoupper($update_tables['aks']['planet_type']['Type']) != 'TINYINT(1) UNSIGNED'); |
|
832 | + upd_do_query('COMMIT;', true); |
|
833 | + $new_version = 31; |
|
841 | 834 | |
842 | - upd_alter_table('alliance', array( |
|
843 | - "MODIFY COLUMN `ally_request_notallow` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", |
|
844 | - "MODIFY COLUMN `ally_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
845 | - ), strtoupper($update_tables['alliance']['ally_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
835 | + case 31: |
|
836 | + upd_log_version_update(); |
|
846 | 837 | |
847 | - if(strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
848 | - { |
|
849 | - upd_alter_table('alliance_diplomacy', array( |
|
850 | - "DROP FOREIGN KEY `FK_diplomacy_ally_id`", |
|
851 | - "DROP FOREIGN KEY `FK_diplomacy_contr_ally_id`" |
|
852 | - ), true); |
|
853 | - |
|
854 | - upd_alter_table('alliance_diplomacy', array( |
|
855 | - "MODIFY COLUMN `alliance_diplomacy_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
856 | - "MODIFY COLUMN `alliance_diplomacy_contr_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
857 | - |
|
858 | - "ADD CONSTRAINT `FK_diplomacy_ally_id` FOREIGN KEY (`alliance_diplomacy_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
859 | - "ADD CONSTRAINT `FK_diplomacy_contr_ally_id` FOREIGN KEY (`alliance_diplomacy_contr_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
860 | - ), true); |
|
861 | - } |
|
838 | + upd_alter_table('aks', array( |
|
839 | + "MODIFY COLUMN `planet_type` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", |
|
840 | + ), strtoupper($update_tables['aks']['planet_type']['Type']) != 'TINYINT(1) UNSIGNED'); |
|
862 | 841 | |
863 | - if(strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
864 | - { |
|
865 | - upd_alter_table('alliance_negotiation', array( |
|
866 | - "DROP FOREIGN KEY `FK_negotiation_ally_id`", |
|
867 | - "DROP FOREIGN KEY `FK_negotiation_contr_ally_id`" |
|
868 | - ), true); |
|
869 | - |
|
870 | - upd_alter_table('alliance_negotiation', array( |
|
871 | - "MODIFY COLUMN `alliance_negotiation_status` TINYINT(1) NOT NULL DEFAULT 0", |
|
872 | - "MODIFY COLUMN `alliance_negotiation_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
873 | - "MODIFY COLUMN `alliance_negotiation_contr_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
874 | - |
|
875 | - "ADD CONSTRAINT `FK_negotiation_ally_id` FOREIGN KEY (`alliance_negotiation_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
876 | - "ADD CONSTRAINT `FK_negotiation_contr_ally_id` FOREIGN KEY (`alliance_negotiation_contr_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
877 | - ), true); |
|
878 | - } |
|
842 | + upd_alter_table('alliance', array( |
|
843 | + "MODIFY COLUMN `ally_request_notallow` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", |
|
844 | + "MODIFY COLUMN `ally_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
845 | + ), strtoupper($update_tables['alliance']['ally_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
879 | 846 | |
880 | - if(strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') |
|
881 | - { |
|
882 | - upd_do_query('DELETE FROM {{alliance_requests}} WHERE id_user NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
|
847 | + if(strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
848 | + { |
|
849 | + upd_alter_table('alliance_diplomacy', array( |
|
850 | + "DROP FOREIGN KEY `FK_diplomacy_ally_id`", |
|
851 | + "DROP FOREIGN KEY `FK_diplomacy_contr_ally_id`" |
|
852 | + ), true); |
|
853 | + |
|
854 | + upd_alter_table('alliance_diplomacy', array( |
|
855 | + "MODIFY COLUMN `alliance_diplomacy_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
856 | + "MODIFY COLUMN `alliance_diplomacy_contr_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
857 | + |
|
858 | + "ADD CONSTRAINT `FK_diplomacy_ally_id` FOREIGN KEY (`alliance_diplomacy_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
859 | + "ADD CONSTRAINT `FK_diplomacy_contr_ally_id` FOREIGN KEY (`alliance_diplomacy_contr_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
860 | + ), true); |
|
861 | + } |
|
883 | 862 | |
884 | - upd_alter_table('alliance_requests', array( |
|
885 | - "MODIFY COLUMN `id_user` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
886 | - "MODIFY COLUMN `id_ally` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
863 | + if(strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
864 | + { |
|
865 | + upd_alter_table('alliance_negotiation', array( |
|
866 | + "DROP FOREIGN KEY `FK_negotiation_ally_id`", |
|
867 | + "DROP FOREIGN KEY `FK_negotiation_contr_ally_id`" |
|
868 | + ), true); |
|
869 | + |
|
870 | + upd_alter_table('alliance_negotiation', array( |
|
871 | + "MODIFY COLUMN `alliance_negotiation_status` TINYINT(1) NOT NULL DEFAULT 0", |
|
872 | + "MODIFY COLUMN `alliance_negotiation_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
873 | + "MODIFY COLUMN `alliance_negotiation_contr_ally_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
874 | + |
|
875 | + "ADD CONSTRAINT `FK_negotiation_ally_id` FOREIGN KEY (`alliance_negotiation_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
876 | + "ADD CONSTRAINT `FK_negotiation_contr_ally_id` FOREIGN KEY (`alliance_negotiation_contr_ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
877 | + ), true); |
|
878 | + } |
|
887 | 879 | |
888 | - "ADD KEY `I_alliance_requests_id_ally` (`id_ally`, `id_user`)", |
|
880 | + if(strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') |
|
881 | + { |
|
882 | + upd_do_query('DELETE FROM {{alliance_requests}} WHERE id_user NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
|
889 | 883 | |
890 | - "ADD CONSTRAINT `FK_alliance_request_user_id` FOREIGN KEY (`id_user`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
891 | - "ADD CONSTRAINT `FK_alliance_request_ally_id` FOREIGN KEY (`id_ally`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
892 | - ), true); |
|
893 | - } |
|
884 | + upd_alter_table('alliance_requests', array( |
|
885 | + "MODIFY COLUMN `id_user` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
886 | + "MODIFY COLUMN `id_ally` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
894 | 887 | |
895 | - if(strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
896 | - { |
|
897 | - upd_do_query('DELETE FROM {{annonce}} WHERE user NOT IN (SELECT username FROM {{users}});', true); |
|
888 | + "ADD KEY `I_alliance_requests_id_ally` (`id_ally`, `id_user`)", |
|
898 | 889 | |
899 | - upd_alter_table('annonce', array( |
|
900 | - "MODIFY COLUMN `id` SERIAL", |
|
901 | - "MODIFY COLUMN `user` VARCHAR(64) DEFAULT NULL", |
|
890 | + "ADD CONSTRAINT `FK_alliance_request_user_id` FOREIGN KEY (`id_user`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
891 | + "ADD CONSTRAINT `FK_alliance_request_ally_id` FOREIGN KEY (`id_ally`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
892 | + ), true); |
|
893 | + } |
|
902 | 894 | |
903 | - "ADD KEY `I_annonce_user` (`user`, `id`)", |
|
895 | + if(strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
896 | + { |
|
897 | + upd_do_query('DELETE FROM {{annonce}} WHERE user NOT IN (SELECT username FROM {{users}});', true); |
|
904 | 898 | |
905 | - "ADD CONSTRAINT `FK_annonce_user` FOREIGN KEY (`user`) REFERENCES `{$config->db_prefix}users` (`username`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
906 | - ), true); |
|
907 | - } |
|
899 | + upd_alter_table('annonce', array( |
|
900 | + "MODIFY COLUMN `id` SERIAL", |
|
901 | + "MODIFY COLUMN `user` VARCHAR(64) DEFAULT NULL", |
|
908 | 902 | |
909 | - if(strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
910 | - { |
|
911 | - upd_alter_table('bashing', array( |
|
912 | - "DROP FOREIGN KEY `FK_bashing_user_id`", |
|
913 | - "DROP FOREIGN KEY `FK_bashing_planet_id`", |
|
914 | - ), true); |
|
915 | - |
|
916 | - upd_alter_table('bashing', array( |
|
917 | - "MODIFY COLUMN `bashing_user_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
918 | - "MODIFY COLUMN `bashing_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
919 | - |
|
920 | - "ADD CONSTRAINT `FK_bashing_user_id` FOREIGN KEY (`bashing_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
921 | - "ADD CONSTRAINT `FK_bashing_planet_id` FOREIGN KEY (`bashing_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
922 | - ), true); |
|
923 | - } |
|
903 | + "ADD KEY `I_annonce_user` (`user`, `id`)", |
|
924 | 904 | |
925 | - if(strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
926 | - { |
|
927 | - upd_do_query('DELETE FROM {{buddy}} WHERE sender NOT IN (SELECT id FROM {{users}}) OR owner NOT IN (SELECT id FROM {{users}});', true); |
|
905 | + "ADD CONSTRAINT `FK_annonce_user` FOREIGN KEY (`user`) REFERENCES `{$config->db_prefix}users` (`username`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
906 | + ), true); |
|
907 | + } |
|
928 | 908 | |
929 | - upd_alter_table('buddy', array( |
|
930 | - "MODIFY COLUMN `id` SERIAL", |
|
931 | - "MODIFY COLUMN `sender` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
932 | - "MODIFY COLUMN `owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
933 | - "MODIFY COLUMN `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", |
|
909 | + if(strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
910 | + { |
|
911 | + upd_alter_table('bashing', array( |
|
912 | + "DROP FOREIGN KEY `FK_bashing_user_id`", |
|
913 | + "DROP FOREIGN KEY `FK_bashing_planet_id`", |
|
914 | + ), true); |
|
915 | + |
|
916 | + upd_alter_table('bashing', array( |
|
917 | + "MODIFY COLUMN `bashing_user_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
918 | + "MODIFY COLUMN `bashing_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
919 | + |
|
920 | + "ADD CONSTRAINT `FK_bashing_user_id` FOREIGN KEY (`bashing_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
921 | + "ADD CONSTRAINT `FK_bashing_planet_id` FOREIGN KEY (`bashing_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
922 | + ), true); |
|
923 | + } |
|
934 | 924 | |
935 | - "ADD KEY `I_buddy_sender` (`sender`)", |
|
936 | - "ADD KEY `I_buddy_owner` (`owner`)", |
|
925 | + if(strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
926 | + { |
|
927 | + upd_do_query('DELETE FROM {{buddy}} WHERE sender NOT IN (SELECT id FROM {{users}}) OR owner NOT IN (SELECT id FROM {{users}});', true); |
|
937 | 928 | |
938 | - "ADD CONSTRAINT `FK_buddy_sender_id` FOREIGN KEY (`sender`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
939 | - "ADD CONSTRAINT `FK_buddy_owner_id` FOREIGN KEY (`owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
940 | - ), true); |
|
941 | - } |
|
929 | + upd_alter_table('buddy', array( |
|
930 | + "MODIFY COLUMN `id` SERIAL", |
|
931 | + "MODIFY COLUMN `sender` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
932 | + "MODIFY COLUMN `owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
933 | + "MODIFY COLUMN `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", |
|
942 | 934 | |
943 | - upd_alter_table('chat', array( |
|
944 | - "MODIFY COLUMN `messageid` SERIAL", |
|
945 | - ), strtoupper($update_tables['chat']['messageid']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
935 | + "ADD KEY `I_buddy_sender` (`sender`)", |
|
936 | + "ADD KEY `I_buddy_owner` (`owner`)", |
|
946 | 937 | |
947 | - upd_alter_table('counter', array( |
|
948 | - "CHANGE COLUMN `id` `counter_id` SERIAL", |
|
938 | + "ADD CONSTRAINT `FK_buddy_sender_id` FOREIGN KEY (`sender`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
939 | + "ADD CONSTRAINT `FK_buddy_owner_id` FOREIGN KEY (`owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
940 | + ), true); |
|
941 | + } |
|
949 | 942 | |
950 | - "MODIFY COLUMN `user_id` BIGINT(20) UNSIGNED DEFAULT 0", |
|
943 | + upd_alter_table('chat', array( |
|
944 | + "MODIFY COLUMN `messageid` SERIAL", |
|
945 | + ), strtoupper($update_tables['chat']['messageid']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
951 | 946 | |
952 | - "ADD COLUMN `user_name` VARCHAR(64) DEFAULT '' AFTER `user_id`", |
|
947 | + upd_alter_table('counter', array( |
|
948 | + "CHANGE COLUMN `id` `counter_id` SERIAL", |
|
953 | 949 | |
954 | - "ADD KEY `I_counter_user_name` (`user_name`)", |
|
955 | - ), strtoupper($update_tables['counter']['counter_id']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
950 | + "MODIFY COLUMN `user_id` BIGINT(20) UNSIGNED DEFAULT 0", |
|
956 | 951 | |
957 | - upd_alter_table('fleets', array( |
|
958 | - "MODIFY COLUMN `fleet_id` SERIAL", |
|
959 | - "MODIFY COLUMN `fleet_resource_metal` DECIMAL(65,0) DEFAULT '0'", |
|
960 | - "MODIFY COLUMN `fleet_resource_crystal` DECIMAL(65,0) DEFAULT '0'", |
|
961 | - "MODIFY COLUMN `fleet_resource_deuterium` DECIMAL(65,0) DEFAULT '0'", |
|
962 | - ), strtoupper($update_tables['fleets']['fleet_resource_metal']['Type']) != 'DECIMAL(65,0)'); |
|
952 | + "ADD COLUMN `user_name` VARCHAR(64) DEFAULT '' AFTER `user_id`", |
|
963 | 953 | |
964 | - if(strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
965 | - { |
|
966 | - upd_do_query('DELETE FROM {{iraks}} WHERE owner NOT IN (SELECT id FROM {{users}}) OR zielid NOT IN (SELECT id FROM {{users}});', true); |
|
954 | + "ADD KEY `I_counter_user_name` (`user_name`)", |
|
955 | + ), strtoupper($update_tables['counter']['counter_id']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
967 | 956 | |
968 | - upd_alter_table('iraks', array( |
|
969 | - "CHANGE COLUMN `zeit` `fleet_end_time` INT(11) UNSIGNED NOT NULL DEFAULT 0", |
|
970 | - "CHANGE COLUMN `zielid` `fleet_target_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
971 | - "CHANGE COLUMN `owner` `fleet_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
972 | - "CHANGE COLUMN `anzahl` `fleet_amount` BIGINT(20) UNSIGNED DEFAULT 0", |
|
973 | - "CHANGE COLUMN `galaxy_angreifer` `fleet_start_galaxy` INT(2) UNSIGNED DEFAULT 0", |
|
974 | - "CHANGE COLUMN `system_angreifer` `fleet_start_system` INT(4) UNSIGNED DEFAULT 0", |
|
975 | - "CHANGE COLUMN `planet_angreifer` `fleet_start_planet` INT(2) UNSIGNED DEFAULT 0", |
|
976 | - |
|
977 | - "CHANGE COLUMN `galaxy` `fleet_end_galaxy` INT(2) UNSIGNED DEFAULT 0", |
|
978 | - "CHANGE COLUMN `system` `fleet_end_system` INT(4) UNSIGNED DEFAULT 0", |
|
979 | - "CHANGE COLUMN `planet` `fleet_end_planet` INT(2) UNSIGNED DEFAULT 0", |
|
980 | - |
|
981 | - "ADD KEY `I_iraks_fleet_owner` (`fleet_owner`)", |
|
982 | - "ADD KEY `I_iraks_fleet_target_owner` (`fleet_target_owner`)", |
|
983 | - |
|
984 | - "ADD CONSTRAINT `FK_iraks_fleet_owner` FOREIGN KEY (`fleet_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
985 | - "ADD CONSTRAINT `FK_iraks_fleet_target_owner` FOREIGN KEY (`fleet_target_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
986 | - ), true); |
|
987 | - } |
|
957 | + upd_alter_table('fleets', array( |
|
958 | + "MODIFY COLUMN `fleet_id` SERIAL", |
|
959 | + "MODIFY COLUMN `fleet_resource_metal` DECIMAL(65,0) DEFAULT '0'", |
|
960 | + "MODIFY COLUMN `fleet_resource_crystal` DECIMAL(65,0) DEFAULT '0'", |
|
961 | + "MODIFY COLUMN `fleet_resource_deuterium` DECIMAL(65,0) DEFAULT '0'", |
|
962 | + ), strtoupper($update_tables['fleets']['fleet_resource_metal']['Type']) != 'DECIMAL(65,0)'); |
|
988 | 963 | |
989 | - if(strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
990 | - { |
|
991 | - upd_do_query('DELETE FROM {{notes}} WHERE owner NOT IN (SELECT id FROM {{users}});', true); |
|
964 | + if(strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
965 | + { |
|
966 | + upd_do_query('DELETE FROM {{iraks}} WHERE owner NOT IN (SELECT id FROM {{users}}) OR zielid NOT IN (SELECT id FROM {{users}});', true); |
|
967 | + |
|
968 | + upd_alter_table('iraks', array( |
|
969 | + "CHANGE COLUMN `zeit` `fleet_end_time` INT(11) UNSIGNED NOT NULL DEFAULT 0", |
|
970 | + "CHANGE COLUMN `zielid` `fleet_target_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
971 | + "CHANGE COLUMN `owner` `fleet_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
972 | + "CHANGE COLUMN `anzahl` `fleet_amount` BIGINT(20) UNSIGNED DEFAULT 0", |
|
973 | + "CHANGE COLUMN `galaxy_angreifer` `fleet_start_galaxy` INT(2) UNSIGNED DEFAULT 0", |
|
974 | + "CHANGE COLUMN `system_angreifer` `fleet_start_system` INT(4) UNSIGNED DEFAULT 0", |
|
975 | + "CHANGE COLUMN `planet_angreifer` `fleet_start_planet` INT(2) UNSIGNED DEFAULT 0", |
|
976 | + |
|
977 | + "CHANGE COLUMN `galaxy` `fleet_end_galaxy` INT(2) UNSIGNED DEFAULT 0", |
|
978 | + "CHANGE COLUMN `system` `fleet_end_system` INT(4) UNSIGNED DEFAULT 0", |
|
979 | + "CHANGE COLUMN `planet` `fleet_end_planet` INT(2) UNSIGNED DEFAULT 0", |
|
980 | + |
|
981 | + "ADD KEY `I_iraks_fleet_owner` (`fleet_owner`)", |
|
982 | + "ADD KEY `I_iraks_fleet_target_owner` (`fleet_target_owner`)", |
|
983 | + |
|
984 | + "ADD CONSTRAINT `FK_iraks_fleet_owner` FOREIGN KEY (`fleet_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
985 | + "ADD CONSTRAINT `FK_iraks_fleet_target_owner` FOREIGN KEY (`fleet_target_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
986 | + ), true); |
|
987 | + } |
|
992 | 988 | |
993 | - upd_alter_table('notes', array( |
|
994 | - "MODIFY COLUMN id SERIAL", |
|
995 | - "MODIFY COLUMN `owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
989 | + if(strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
990 | + { |
|
991 | + upd_do_query('DELETE FROM {{notes}} WHERE owner NOT IN (SELECT id FROM {{users}});', true); |
|
996 | 992 | |
997 | - "ADD KEY `I_notes_owner` (`owner`)", |
|
993 | + upd_alter_table('notes', array( |
|
994 | + "MODIFY COLUMN id SERIAL", |
|
995 | + "MODIFY COLUMN `owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
998 | 996 | |
999 | - "ADD CONSTRAINT `FK_notes_owner` FOREIGN KEY (`owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1000 | - ), true); |
|
1001 | - } |
|
997 | + "ADD KEY `I_notes_owner` (`owner`)", |
|
1002 | 998 | |
1003 | - upd_alter_table('planets', array( |
|
1004 | - "MODIFY COLUMN `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT", |
|
1005 | - "MODIFY COLUMN `name` VARCHAR(64) DEFAULT 'Planet' NOT NULL", |
|
1006 | - "MODIFY COLUMN `id_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1007 | - "MODIFY COLUMN `galaxy` SMALLINT NOT NULL DEFAULT '0'", |
|
1008 | - "MODIFY COLUMN `system` SMALLINT NOT NULL DEFAULT '0'", |
|
1009 | - "MODIFY COLUMN `planet` SMALLINT NOT NULL DEFAULT '0'", |
|
1010 | - "MODIFY COLUMN `planet_type` TINYINT NOT NULL DEFAULT '1'", |
|
1011 | - |
|
1012 | - "MODIFY COLUMN `metal` DECIMAL(65,5) NOT NULL DEFAULT '0'", |
|
1013 | - "MODIFY COLUMN `crystal` DECIMAL(65,5) NOT NULL DEFAULT '0' AFTER `metal`", |
|
1014 | - "MODIFY COLUMN `deuterium` DECIMAL(65,5) NOT NULL DEFAULT '0' AFTER `crystal`", |
|
1015 | - "MODIFY COLUMN `energy_max` DECIMAL(65,0) NOT NULL DEFAULT '0' AFTER `deuterium`", |
|
1016 | - "MODIFY COLUMN `energy_used` DECIMAL(65,0) NOT NULL DEFAULT '0' AFTER `energy_max`", |
|
1017 | - |
|
1018 | - "MODIFY COLUMN `metal_mine` SMALLINT NOT NULL DEFAULT '0'", |
|
1019 | - "MODIFY COLUMN `crystal_mine` SMALLINT NOT NULL DEFAULT '0'", |
|
1020 | - "MODIFY COLUMN `deuterium_sintetizer` SMALLINT NOT NULL DEFAULT '0'", |
|
1021 | - "MODIFY COLUMN `solar_plant` SMALLINT NOT NULL DEFAULT '0'", |
|
1022 | - "MODIFY COLUMN `fusion_plant` SMALLINT NOT NULL DEFAULT '0'", |
|
1023 | - "MODIFY COLUMN `robot_factory` SMALLINT NOT NULL DEFAULT '0'", |
|
1024 | - "MODIFY COLUMN `nano_factory` SMALLINT NOT NULL DEFAULT '0'", |
|
1025 | - "MODIFY COLUMN `hangar` SMALLINT NOT NULL DEFAULT '0'", |
|
1026 | - "MODIFY COLUMN `metal_store` SMALLINT NOT NULL DEFAULT '0'", |
|
1027 | - "MODIFY COLUMN `crystal_store` SMALLINT NOT NULL DEFAULT '0'", |
|
1028 | - "MODIFY COLUMN `deuterium_store` SMALLINT NOT NULL DEFAULT '0'", |
|
1029 | - "MODIFY COLUMN `laboratory` SMALLINT NOT NULL DEFAULT '0'", |
|
1030 | - "MODIFY COLUMN `nano` SMALLINT DEFAULT '0' AFTER `laboratory`", |
|
1031 | - "MODIFY COLUMN `terraformer` SMALLINT NOT NULL DEFAULT '0'", |
|
1032 | - "MODIFY COLUMN `ally_deposit` SMALLINT NOT NULL DEFAULT '0'", |
|
1033 | - "MODIFY COLUMN `silo` SMALLINT NOT NULL DEFAULT '0'", |
|
1034 | - "MODIFY COLUMN `mondbasis` SMALLINT NOT NULL DEFAULT '0' AFTER `silo`", |
|
1035 | - "MODIFY COLUMN `phalanx` SMALLINT NOT NULL DEFAULT '0' AFTER `mondbasis`", |
|
1036 | - "MODIFY COLUMN `sprungtor` SMALLINT NOT NULL DEFAULT '0' AFTER `phalanx`", |
|
1037 | - "MODIFY COLUMN `last_jump_time` int(11) NOT NULL DEFAULT '0' AFTER `sprungtor`", |
|
1038 | - |
|
1039 | - "MODIFY COLUMN `small_ship_cargo` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1040 | - "MODIFY COLUMN `big_ship_cargo` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1041 | - "MODIFY COLUMN `supercargo` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Supercargo ship count' AFTER `big_ship_cargo`", |
|
1042 | - "MODIFY COLUMN `planet_cargo_hyper` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `supercargo`", |
|
1043 | - "MODIFY COLUMN `recycler` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `planet_cargo_hyper`", |
|
1044 | - "MODIFY COLUMN `colonizer` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `recycler`", |
|
1045 | - "MODIFY COLUMN `spy_sonde` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `colonizer`", |
|
1046 | - "MODIFY COLUMN `solar_satelit` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `spy_sonde`", |
|
1047 | - |
|
1048 | - "MODIFY COLUMN `light_hunter` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1049 | - "MODIFY COLUMN `heavy_hunter` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1050 | - "MODIFY COLUMN `crusher` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1051 | - "MODIFY COLUMN `battle_ship` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1052 | - "MODIFY COLUMN `bomber_ship` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1053 | - "MODIFY COLUMN `battleship` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `bomber_ship`", |
|
1054 | - "MODIFY COLUMN `destructor` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1055 | - "MODIFY COLUMN `dearth_star` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1056 | - "MODIFY COLUMN `supernova` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1057 | - |
|
1058 | - "MODIFY COLUMN `misil_launcher` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1059 | - "MODIFY COLUMN `small_laser` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1060 | - "MODIFY COLUMN `big_laser` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1061 | - "MODIFY COLUMN `gauss_canyon` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1062 | - "MODIFY COLUMN `ionic_canyon` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1063 | - "MODIFY COLUMN `buster_canyon` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1064 | - |
|
1065 | - "MODIFY COLUMN `small_protection_shield` tinyint(1) NOT NULL DEFAULT '0'", |
|
1066 | - "MODIFY COLUMN `big_protection_shield` tinyint(1) NOT NULL DEFAULT '0'", |
|
1067 | - "MODIFY COLUMN `planet_protector` tinyint(1) NOT NULL DEFAULT '0'", |
|
1068 | - |
|
1069 | - "MODIFY COLUMN `interceptor_misil` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1070 | - "MODIFY COLUMN `interplanetary_misil` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1071 | - |
|
1072 | - "MODIFY COLUMN `metal_perhour` INT NOT NULL DEFAULT '0' AFTER `interplanetary_misil`", |
|
1073 | - "MODIFY COLUMN `crystal_perhour` INT NOT NULL DEFAULT '0' AFTER `metal_perhour`", |
|
1074 | - "MODIFY COLUMN `deuterium_perhour` INT NOT NULL DEFAULT '0' AFTER `crystal_perhour`", |
|
1075 | - |
|
1076 | - "MODIFY COLUMN `metal_mine_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1077 | - "MODIFY COLUMN `crystal_mine_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1078 | - "MODIFY COLUMN `deuterium_sintetizer_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1079 | - "MODIFY COLUMN `solar_plant_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1080 | - "MODIFY COLUMN `fusion_plant_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1081 | - "MODIFY COLUMN `solar_satelit_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1082 | - |
|
1083 | - "MODIFY COLUMN `que` TEXT COMMENT 'Planet que' AFTER `solar_satelit_porcent`", |
|
1084 | -// "MODIFY COLUMN `b_tech` INT(11) NOT NULL DEFAULT 0 AFTER `que`", |
|
1085 | -// "MODIFY COLUMN `b_tech_id` SMALLINT NOT NULL DEFAULT 0 AFTER `b_tech`", |
|
1086 | - "MODIFY COLUMN `b_hangar` INT(11) NOT NULL DEFAULT '0' AFTER `que`", |
|
1087 | - "MODIFY COLUMN `b_hangar_id` TEXT AFTER `b_hangar`", |
|
1088 | - "MODIFY COLUMN `last_update` INT(11) DEFAULT NULL AFTER `b_hangar_id`", |
|
1089 | - |
|
1090 | - "MODIFY COLUMN `image` varchar(64) NOT NULL DEFAULT 'normaltempplanet01' AFTER `last_update`", |
|
1091 | - "MODIFY COLUMN `points` bigint(20) DEFAULT '0' AFTER `image`", |
|
1092 | - "MODIFY COLUMN `ranks` bigint(20) DEFAULT '0' AFTER `points`", |
|
1093 | - "MODIFY COLUMN `id_level` TINYINT NOT NULL DEFAULT '0' AFTER `ranks`", |
|
1094 | - "MODIFY COLUMN `destruyed` int(11) NOT NULL DEFAULT '0' AFTER `id_level`", |
|
1095 | - "MODIFY COLUMN `diameter` int(11) NOT NULL DEFAULT '12800' AFTER `destruyed`", |
|
1096 | - "MODIFY COLUMN `field_max` SMALLINT UNSIGNED NOT NULL DEFAULT '163' AFTER `diameter`", |
|
1097 | - "MODIFY COLUMN `field_current` SMALLINT UNSIGNED NOT NULL DEFAULT '0' AFTER `field_max`", |
|
1098 | - "MODIFY COLUMN `temp_min` SMALLINT NOT NULL DEFAULT '0' AFTER `field_current`", |
|
1099 | - "MODIFY COLUMN `temp_max` SMALLINT NOT NULL DEFAULT '40' AFTER `temp_min`", |
|
1100 | - |
|
1101 | - "MODIFY COLUMN `metal_max` DECIMAL(65,0) DEFAULT '100000' AFTER `temp_max`", |
|
1102 | - "MODIFY COLUMN `crystal_max` DECIMAL(65,0) DEFAULT '100000' AFTER `metal_max`", |
|
1103 | - "MODIFY COLUMN `deuterium_max` DECIMAL(65,0) DEFAULT '100000' AFTER `crystal_max`", |
|
1104 | - |
|
1105 | - "MODIFY COLUMN `debris_metal` bigint(20) unsigned DEFAULT '0'", |
|
1106 | - "MODIFY COLUMN `debris_crystal` bigint(20) unsigned DEFAULT '0'", |
|
1107 | - "MODIFY COLUMN `PLANET_GOVERNOR_ID` SMALLINT NOT NULL DEFAULT '0'", |
|
1108 | - "MODIFY COLUMN `PLANET_GOVERNOR_LEVEL` SMALLINT NOT NULL DEFAULT '0'", |
|
1109 | - |
|
1110 | - "MODIFY COLUMN `parent_planet` BIGINT(20) unsigned DEFAULT '0'", |
|
1111 | - |
|
1112 | - "DROP COLUMN `b_hangar_plus`", |
|
1113 | - ), isset($update_tables['planets']['b_hangar_plus'])); |
|
1114 | - |
|
1115 | - if(strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1116 | - { |
|
1117 | - upd_do_query('DELETE FROM {{referrals}} WHERE id NOT IN (SELECT id FROM {{users}}) OR id_partner NOT IN (SELECT id FROM {{users}});', true); |
|
999 | + "ADD CONSTRAINT `FK_notes_owner` FOREIGN KEY (`owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1000 | + ), true); |
|
1001 | + } |
|
1118 | 1002 | |
1119 | - upd_alter_table('referrals', array( |
|
1120 | - "MODIFY COLUMN `id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1121 | - "MODIFY COLUMN `id_partner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1122 | - "MODIFY COLUMN `dark_matter` DECIMAL(65,0) NOT NULL DEFAULT '0'", |
|
1003 | + upd_alter_table('planets', array( |
|
1004 | + "MODIFY COLUMN `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT", |
|
1005 | + "MODIFY COLUMN `name` VARCHAR(64) DEFAULT 'Planet' NOT NULL", |
|
1006 | + "MODIFY COLUMN `id_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1007 | + "MODIFY COLUMN `galaxy` SMALLINT NOT NULL DEFAULT '0'", |
|
1008 | + "MODIFY COLUMN `system` SMALLINT NOT NULL DEFAULT '0'", |
|
1009 | + "MODIFY COLUMN `planet` SMALLINT NOT NULL DEFAULT '0'", |
|
1010 | + "MODIFY COLUMN `planet_type` TINYINT NOT NULL DEFAULT '1'", |
|
1011 | + |
|
1012 | + "MODIFY COLUMN `metal` DECIMAL(65,5) NOT NULL DEFAULT '0'", |
|
1013 | + "MODIFY COLUMN `crystal` DECIMAL(65,5) NOT NULL DEFAULT '0' AFTER `metal`", |
|
1014 | + "MODIFY COLUMN `deuterium` DECIMAL(65,5) NOT NULL DEFAULT '0' AFTER `crystal`", |
|
1015 | + "MODIFY COLUMN `energy_max` DECIMAL(65,0) NOT NULL DEFAULT '0' AFTER `deuterium`", |
|
1016 | + "MODIFY COLUMN `energy_used` DECIMAL(65,0) NOT NULL DEFAULT '0' AFTER `energy_max`", |
|
1017 | + |
|
1018 | + "MODIFY COLUMN `metal_mine` SMALLINT NOT NULL DEFAULT '0'", |
|
1019 | + "MODIFY COLUMN `crystal_mine` SMALLINT NOT NULL DEFAULT '0'", |
|
1020 | + "MODIFY COLUMN `deuterium_sintetizer` SMALLINT NOT NULL DEFAULT '0'", |
|
1021 | + "MODIFY COLUMN `solar_plant` SMALLINT NOT NULL DEFAULT '0'", |
|
1022 | + "MODIFY COLUMN `fusion_plant` SMALLINT NOT NULL DEFAULT '0'", |
|
1023 | + "MODIFY COLUMN `robot_factory` SMALLINT NOT NULL DEFAULT '0'", |
|
1024 | + "MODIFY COLUMN `nano_factory` SMALLINT NOT NULL DEFAULT '0'", |
|
1025 | + "MODIFY COLUMN `hangar` SMALLINT NOT NULL DEFAULT '0'", |
|
1026 | + "MODIFY COLUMN `metal_store` SMALLINT NOT NULL DEFAULT '0'", |
|
1027 | + "MODIFY COLUMN `crystal_store` SMALLINT NOT NULL DEFAULT '0'", |
|
1028 | + "MODIFY COLUMN `deuterium_store` SMALLINT NOT NULL DEFAULT '0'", |
|
1029 | + "MODIFY COLUMN `laboratory` SMALLINT NOT NULL DEFAULT '0'", |
|
1030 | + "MODIFY COLUMN `nano` SMALLINT DEFAULT '0' AFTER `laboratory`", |
|
1031 | + "MODIFY COLUMN `terraformer` SMALLINT NOT NULL DEFAULT '0'", |
|
1032 | + "MODIFY COLUMN `ally_deposit` SMALLINT NOT NULL DEFAULT '0'", |
|
1033 | + "MODIFY COLUMN `silo` SMALLINT NOT NULL DEFAULT '0'", |
|
1034 | + "MODIFY COLUMN `mondbasis` SMALLINT NOT NULL DEFAULT '0' AFTER `silo`", |
|
1035 | + "MODIFY COLUMN `phalanx` SMALLINT NOT NULL DEFAULT '0' AFTER `mondbasis`", |
|
1036 | + "MODIFY COLUMN `sprungtor` SMALLINT NOT NULL DEFAULT '0' AFTER `phalanx`", |
|
1037 | + "MODIFY COLUMN `last_jump_time` int(11) NOT NULL DEFAULT '0' AFTER `sprungtor`", |
|
1038 | + |
|
1039 | + "MODIFY COLUMN `small_ship_cargo` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1040 | + "MODIFY COLUMN `big_ship_cargo` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1041 | + "MODIFY COLUMN `supercargo` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Supercargo ship count' AFTER `big_ship_cargo`", |
|
1042 | + "MODIFY COLUMN `planet_cargo_hyper` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `supercargo`", |
|
1043 | + "MODIFY COLUMN `recycler` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `planet_cargo_hyper`", |
|
1044 | + "MODIFY COLUMN `colonizer` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `recycler`", |
|
1045 | + "MODIFY COLUMN `spy_sonde` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `colonizer`", |
|
1046 | + "MODIFY COLUMN `solar_satelit` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `spy_sonde`", |
|
1047 | + |
|
1048 | + "MODIFY COLUMN `light_hunter` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1049 | + "MODIFY COLUMN `heavy_hunter` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1050 | + "MODIFY COLUMN `crusher` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1051 | + "MODIFY COLUMN `battle_ship` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1052 | + "MODIFY COLUMN `bomber_ship` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1053 | + "MODIFY COLUMN `battleship` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AFTER `bomber_ship`", |
|
1054 | + "MODIFY COLUMN `destructor` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1055 | + "MODIFY COLUMN `dearth_star` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1056 | + "MODIFY COLUMN `supernova` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1057 | + |
|
1058 | + "MODIFY COLUMN `misil_launcher` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1059 | + "MODIFY COLUMN `small_laser` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1060 | + "MODIFY COLUMN `big_laser` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1061 | + "MODIFY COLUMN `gauss_canyon` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1062 | + "MODIFY COLUMN `ionic_canyon` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1063 | + "MODIFY COLUMN `buster_canyon` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1064 | + |
|
1065 | + "MODIFY COLUMN `small_protection_shield` tinyint(1) NOT NULL DEFAULT '0'", |
|
1066 | + "MODIFY COLUMN `big_protection_shield` tinyint(1) NOT NULL DEFAULT '0'", |
|
1067 | + "MODIFY COLUMN `planet_protector` tinyint(1) NOT NULL DEFAULT '0'", |
|
1068 | + |
|
1069 | + "MODIFY COLUMN `interceptor_misil` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1070 | + "MODIFY COLUMN `interplanetary_misil` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0'", |
|
1071 | + |
|
1072 | + "MODIFY COLUMN `metal_perhour` INT NOT NULL DEFAULT '0' AFTER `interplanetary_misil`", |
|
1073 | + "MODIFY COLUMN `crystal_perhour` INT NOT NULL DEFAULT '0' AFTER `metal_perhour`", |
|
1074 | + "MODIFY COLUMN `deuterium_perhour` INT NOT NULL DEFAULT '0' AFTER `crystal_perhour`", |
|
1075 | + |
|
1076 | + "MODIFY COLUMN `metal_mine_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1077 | + "MODIFY COLUMN `crystal_mine_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1078 | + "MODIFY COLUMN `deuterium_sintetizer_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1079 | + "MODIFY COLUMN `solar_plant_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1080 | + "MODIFY COLUMN `fusion_plant_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1081 | + "MODIFY COLUMN `solar_satelit_porcent` TINYINT UNSIGNED NOT NULL DEFAULT '10'", |
|
1082 | + |
|
1083 | + "MODIFY COLUMN `que` TEXT COMMENT 'Planet que' AFTER `solar_satelit_porcent`", |
|
1084 | + // "MODIFY COLUMN `b_tech` INT(11) NOT NULL DEFAULT 0 AFTER `que`", |
|
1085 | + // "MODIFY COLUMN `b_tech_id` SMALLINT NOT NULL DEFAULT 0 AFTER `b_tech`", |
|
1086 | + "MODIFY COLUMN `b_hangar` INT(11) NOT NULL DEFAULT '0' AFTER `que`", |
|
1087 | + "MODIFY COLUMN `b_hangar_id` TEXT AFTER `b_hangar`", |
|
1088 | + "MODIFY COLUMN `last_update` INT(11) DEFAULT NULL AFTER `b_hangar_id`", |
|
1089 | + |
|
1090 | + "MODIFY COLUMN `image` varchar(64) NOT NULL DEFAULT 'normaltempplanet01' AFTER `last_update`", |
|
1091 | + "MODIFY COLUMN `points` bigint(20) DEFAULT '0' AFTER `image`", |
|
1092 | + "MODIFY COLUMN `ranks` bigint(20) DEFAULT '0' AFTER `points`", |
|
1093 | + "MODIFY COLUMN `id_level` TINYINT NOT NULL DEFAULT '0' AFTER `ranks`", |
|
1094 | + "MODIFY COLUMN `destruyed` int(11) NOT NULL DEFAULT '0' AFTER `id_level`", |
|
1095 | + "MODIFY COLUMN `diameter` int(11) NOT NULL DEFAULT '12800' AFTER `destruyed`", |
|
1096 | + "MODIFY COLUMN `field_max` SMALLINT UNSIGNED NOT NULL DEFAULT '163' AFTER `diameter`", |
|
1097 | + "MODIFY COLUMN `field_current` SMALLINT UNSIGNED NOT NULL DEFAULT '0' AFTER `field_max`", |
|
1098 | + "MODIFY COLUMN `temp_min` SMALLINT NOT NULL DEFAULT '0' AFTER `field_current`", |
|
1099 | + "MODIFY COLUMN `temp_max` SMALLINT NOT NULL DEFAULT '40' AFTER `temp_min`", |
|
1100 | + |
|
1101 | + "MODIFY COLUMN `metal_max` DECIMAL(65,0) DEFAULT '100000' AFTER `temp_max`", |
|
1102 | + "MODIFY COLUMN `crystal_max` DECIMAL(65,0) DEFAULT '100000' AFTER `metal_max`", |
|
1103 | + "MODIFY COLUMN `deuterium_max` DECIMAL(65,0) DEFAULT '100000' AFTER `crystal_max`", |
|
1104 | + |
|
1105 | + "MODIFY COLUMN `debris_metal` bigint(20) unsigned DEFAULT '0'", |
|
1106 | + "MODIFY COLUMN `debris_crystal` bigint(20) unsigned DEFAULT '0'", |
|
1107 | + "MODIFY COLUMN `PLANET_GOVERNOR_ID` SMALLINT NOT NULL DEFAULT '0'", |
|
1108 | + "MODIFY COLUMN `PLANET_GOVERNOR_LEVEL` SMALLINT NOT NULL DEFAULT '0'", |
|
1109 | + |
|
1110 | + "MODIFY COLUMN `parent_planet` BIGINT(20) unsigned DEFAULT '0'", |
|
1111 | + |
|
1112 | + "DROP COLUMN `b_hangar_plus`", |
|
1113 | + ), isset($update_tables['planets']['b_hangar_plus'])); |
|
1114 | + |
|
1115 | + if(strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1116 | + { |
|
1117 | + upd_do_query('DELETE FROM {{referrals}} WHERE id NOT IN (SELECT id FROM {{users}}) OR id_partner NOT IN (SELECT id FROM {{users}});', true); |
|
1123 | 1118 | |
1124 | - "ADD CONSTRAINT `FK_referrals_id` FOREIGN KEY (`id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1125 | - "ADD CONSTRAINT `FK_referrals_id_partner` FOREIGN KEY (`id_partner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1126 | - ), true); |
|
1127 | - } |
|
1119 | + upd_alter_table('referrals', array( |
|
1120 | + "MODIFY COLUMN `id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1121 | + "MODIFY COLUMN `id_partner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1122 | + "MODIFY COLUMN `dark_matter` DECIMAL(65,0) NOT NULL DEFAULT '0'", |
|
1128 | 1123 | |
1129 | - upd_alter_table('rw', array( |
|
1130 | - "MODIFY COLUMN `report_id` SERIAL", |
|
1131 | - "MODIFY COLUMN `id_owner1` BIGINT(20) UNSIGNED", |
|
1132 | - "MODIFY COLUMN `id_owner2` BIGINT(20) UNSIGNED", |
|
1133 | - ), strtoupper($update_tables['rw']['id_owner1']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
1124 | + "ADD CONSTRAINT `FK_referrals_id` FOREIGN KEY (`id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1125 | + "ADD CONSTRAINT `FK_referrals_id_partner` FOREIGN KEY (`id_partner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1126 | + ), true); |
|
1127 | + } |
|
1134 | 1128 | |
1135 | - if(strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1136 | - { |
|
1137 | - upd_do_query('DELETE FROM {{shortcut}} WHERE shortcut_user_id NOT IN (SELECT id FROM {{users}}) OR shortcut_planet_id NOT IN (SELECT id FROM {{planets}});', true); |
|
1138 | - |
|
1139 | - upd_alter_table('shortcut', array( |
|
1140 | - "MODIFY COLUMN `shortcut_id` SERIAL", |
|
1141 | - "MODIFY COLUMN `shortcut_user_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1142 | - "MODIFY COLUMN `shortcut_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1143 | - "MODIFY COLUMN `shortcut_galaxy` TINYINT UNSIGNED DEFAULT 0", |
|
1144 | - "MODIFY COLUMN `shortcut_system` SMALLINT UNSIGNED DEFAULT 0", |
|
1145 | - "MODIFY COLUMN `shortcut_planet` TINYINT UNSIGNED DEFAULT 0", |
|
1146 | - |
|
1147 | - "ADD CONSTRAINT `FK_shortcut_planet_id` FOREIGN KEY (`shortcut_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1148 | - ), true); |
|
1149 | - } |
|
1129 | + upd_alter_table('rw', array( |
|
1130 | + "MODIFY COLUMN `report_id` SERIAL", |
|
1131 | + "MODIFY COLUMN `id_owner1` BIGINT(20) UNSIGNED", |
|
1132 | + "MODIFY COLUMN `id_owner2` BIGINT(20) UNSIGNED", |
|
1133 | + ), strtoupper($update_tables['rw']['id_owner1']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
1150 | 1134 | |
1151 | - if(strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1152 | - { |
|
1153 | - upd_do_query('DELETE FROM {{statpoints}} WHERE id_owner NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
|
1135 | + if(strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1136 | + { |
|
1137 | + upd_do_query('DELETE FROM {{shortcut}} WHERE shortcut_user_id NOT IN (SELECT id FROM {{users}}) OR shortcut_planet_id NOT IN (SELECT id FROM {{planets}});', true); |
|
1138 | + |
|
1139 | + upd_alter_table('shortcut', array( |
|
1140 | + "MODIFY COLUMN `shortcut_id` SERIAL", |
|
1141 | + "MODIFY COLUMN `shortcut_user_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1142 | + "MODIFY COLUMN `shortcut_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1143 | + "MODIFY COLUMN `shortcut_galaxy` TINYINT UNSIGNED DEFAULT 0", |
|
1144 | + "MODIFY COLUMN `shortcut_system` SMALLINT UNSIGNED DEFAULT 0", |
|
1145 | + "MODIFY COLUMN `shortcut_planet` TINYINT UNSIGNED DEFAULT 0", |
|
1146 | + |
|
1147 | + "ADD CONSTRAINT `FK_shortcut_planet_id` FOREIGN KEY (`shortcut_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1148 | + ), true); |
|
1149 | + } |
|
1154 | 1150 | |
1155 | - upd_alter_table('statpoints', array( |
|
1156 | - "MODIFY COLUMN `stat_date` int(11) NOT NULL DEFAULT '0' FIRST", |
|
1157 | - "MODIFY COLUMN `id_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1158 | - "MODIFY COLUMN `id_ally` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1159 | - "MODIFY COLUMN `stat_type` TINYINT UNSIGNED DEFAULT 0", |
|
1160 | - "MODIFY COLUMN `stat_code` TINYINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1161 | - |
|
1162 | - "MODIFY COLUMN `tech_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1163 | - "MODIFY COLUMN `tech_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1164 | - "MODIFY COLUMN `tech_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1165 | - "MODIFY COLUMN `tech_count` DECIMAL(65,0) UNSIGNED UNSIGNED NOT NULL DEFAULT '0'", |
|
1166 | - |
|
1167 | - "MODIFY COLUMN `build_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1168 | - "MODIFY COLUMN `build_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1169 | - "MODIFY COLUMN `build_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1170 | - "MODIFY COLUMN `build_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1171 | - |
|
1172 | - "MODIFY COLUMN `defs_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1173 | - "MODIFY COLUMN `defs_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1174 | - "MODIFY COLUMN `defs_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1175 | - "MODIFY COLUMN `defs_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1176 | - |
|
1177 | - "MODIFY COLUMN `fleet_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1178 | - "MODIFY COLUMN `fleet_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1179 | - "MODIFY COLUMN `fleet_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1180 | - "MODIFY COLUMN `fleet_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1181 | - |
|
1182 | - "MODIFY COLUMN `res_rank` INT(11) UNSIGNED DEFAULT '0' COMMENT 'Rank by resources' AFTER `fleet_count`", |
|
1183 | - "MODIFY COLUMN `res_old_rank` INT(11) UNSIGNED DEFAULT '0' COMMENT 'Old rank by resources'AFTER `res_rank`", |
|
1184 | - "MODIFY COLUMN `res_points` DECIMAL(65,0) UNSIGNED DEFAULT '0' COMMENT 'Resource stat points' AFTER `res_old_rank`", |
|
1185 | - "MODIFY COLUMN `res_count` DECIMAL(65,0) UNSIGNED DEFAULT '0' COMMENT 'Resource count' AFTER `res_points`", |
|
1186 | - |
|
1187 | - "MODIFY COLUMN `total_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1188 | - "MODIFY COLUMN `total_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1189 | - "MODIFY COLUMN `total_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1190 | - "MODIFY COLUMN `total_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1191 | - |
|
1192 | - "ADD KEY `I_stats_id_ally` (`id_ally`)", |
|
1193 | - |
|
1194 | - "ADD CONSTRAINT `FK_stats_id_owner` FOREIGN KEY (`id_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1195 | - "ADD CONSTRAINT `FK_stats_id_ally` FOREIGN KEY (`id_ally`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1196 | - ), true); |
|
1197 | - } |
|
1151 | + if(strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1152 | + { |
|
1153 | + upd_do_query('DELETE FROM {{statpoints}} WHERE id_owner NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
|
1154 | + |
|
1155 | + upd_alter_table('statpoints', array( |
|
1156 | + "MODIFY COLUMN `stat_date` int(11) NOT NULL DEFAULT '0' FIRST", |
|
1157 | + "MODIFY COLUMN `id_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1158 | + "MODIFY COLUMN `id_ally` BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1159 | + "MODIFY COLUMN `stat_type` TINYINT UNSIGNED DEFAULT 0", |
|
1160 | + "MODIFY COLUMN `stat_code` TINYINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1161 | + |
|
1162 | + "MODIFY COLUMN `tech_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1163 | + "MODIFY COLUMN `tech_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1164 | + "MODIFY COLUMN `tech_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1165 | + "MODIFY COLUMN `tech_count` DECIMAL(65,0) UNSIGNED UNSIGNED NOT NULL DEFAULT '0'", |
|
1166 | + |
|
1167 | + "MODIFY COLUMN `build_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1168 | + "MODIFY COLUMN `build_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1169 | + "MODIFY COLUMN `build_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1170 | + "MODIFY COLUMN `build_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1171 | + |
|
1172 | + "MODIFY COLUMN `defs_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1173 | + "MODIFY COLUMN `defs_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1174 | + "MODIFY COLUMN `defs_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1175 | + "MODIFY COLUMN `defs_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1176 | + |
|
1177 | + "MODIFY COLUMN `fleet_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1178 | + "MODIFY COLUMN `fleet_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1179 | + "MODIFY COLUMN `fleet_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1180 | + "MODIFY COLUMN `fleet_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1181 | + |
|
1182 | + "MODIFY COLUMN `res_rank` INT(11) UNSIGNED DEFAULT '0' COMMENT 'Rank by resources' AFTER `fleet_count`", |
|
1183 | + "MODIFY COLUMN `res_old_rank` INT(11) UNSIGNED DEFAULT '0' COMMENT 'Old rank by resources'AFTER `res_rank`", |
|
1184 | + "MODIFY COLUMN `res_points` DECIMAL(65,0) UNSIGNED DEFAULT '0' COMMENT 'Resource stat points' AFTER `res_old_rank`", |
|
1185 | + "MODIFY COLUMN `res_count` DECIMAL(65,0) UNSIGNED DEFAULT '0' COMMENT 'Resource count' AFTER `res_points`", |
|
1186 | + |
|
1187 | + "MODIFY COLUMN `total_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1188 | + "MODIFY COLUMN `total_old_rank` INT(11) UNSIGNED NOT NULL DEFAULT '0'", |
|
1189 | + "MODIFY COLUMN `total_points` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1190 | + "MODIFY COLUMN `total_count` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT '0'", |
|
1191 | + |
|
1192 | + "ADD KEY `I_stats_id_ally` (`id_ally`)", |
|
1193 | + |
|
1194 | + "ADD CONSTRAINT `FK_stats_id_owner` FOREIGN KEY (`id_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1195 | + "ADD CONSTRAINT `FK_stats_id_ally` FOREIGN KEY (`id_ally`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1196 | + ), true); |
|
1197 | + } |
|
1198 | 1198 | |
1199 | - upd_alter_table('users', array( |
|
1200 | - "MODIFY COLUMN `authlevel` tinyint unsigned NOT NULL DEFAULT '0' AFTER `username`", |
|
1201 | - "MODIFY COLUMN `vacation` int(11) unsigned DEFAULT '0' AFTER `authlevel`", |
|
1202 | - "MODIFY COLUMN `banaday` int(11) unsigned DEFAULT '0' AFTER `vacation`", |
|
1203 | - "MODIFY COLUMN `dark_matter` bigint(20) DEFAULT '0' AFTER `banaday`", |
|
1204 | - "MODIFY COLUMN `spy_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1205 | - "MODIFY COLUMN `computer_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1206 | - "MODIFY COLUMN `military_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1207 | - "MODIFY COLUMN `defence_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1208 | - "MODIFY COLUMN `shield_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1209 | - "MODIFY COLUMN `energy_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1210 | - "MODIFY COLUMN `hyperspace_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1211 | - "MODIFY COLUMN `combustion_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1212 | - "MODIFY COLUMN `impulse_motor_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1213 | - "MODIFY COLUMN `hyperspace_motor_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1214 | - "MODIFY COLUMN `laser_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1215 | - "MODIFY COLUMN `ionic_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1216 | - "MODIFY COLUMN `buster_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1217 | - "MODIFY COLUMN `intergalactic_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1218 | - "MODIFY COLUMN `expedition_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1219 | - "MODIFY COLUMN `colonisation_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1220 | - "MODIFY COLUMN `graviton_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1221 | - "MODIFY COLUMN `player_artifact_list` text AFTER `graviton_tech`", |
|
1222 | - "MODIFY COLUMN `ally_id` bigint(20) unsigned DEFAULT NULL AFTER `player_artifact_list`", |
|
1223 | - "MODIFY COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
|
1224 | - "MODIFY COLUMN `ally_name` varchar(32) DEFAULT NULL AFTER `ally_tag`", |
|
1225 | - "MODIFY COLUMN `ally_register_time` int(11) NOT NULL DEFAULT '0' AFTER `ally_name`", |
|
1226 | - "MODIFY COLUMN `ally_rank_id` int(11) NOT NULL DEFAULT '0' AFTER `ally_register_time`", |
|
1227 | - "MODIFY COLUMN `player_que` text AFTER `ally_rank_id`", |
|
1228 | - "MODIFY COLUMN `lvl_minier` bigint(20) unsigned NOT NULL DEFAULT '1'", |
|
1229 | - "MODIFY COLUMN `xpminier` bigint(20) unsigned DEFAULT '0' AFTER `lvl_minier`", |
|
1230 | - "MODIFY COLUMN `player_rpg_tech_xp` bigint(20) unsigned NOT NULL DEFAULT '0'", |
|
1231 | - "MODIFY COLUMN `player_rpg_tech_level` bigint(20) unsigned NOT NULL DEFAULT '0'", |
|
1232 | - "MODIFY COLUMN `lvl_raid` bigint(20) unsigned NOT NULL DEFAULT '1' AFTER `player_rpg_tech_level`", |
|
1233 | - "MODIFY COLUMN `xpraid` bigint(20) unsigned DEFAULT '0'", |
|
1234 | - "MODIFY COLUMN `raids` bigint(20) unsigned DEFAULT '0'", |
|
1235 | - "MODIFY COLUMN `raidsloose` bigint(20) unsigned DEFAULT '0'", |
|
1236 | - "MODIFY COLUMN `raidswin` bigint(20) unsigned DEFAULT '0'", |
|
1237 | - "MODIFY COLUMN `new_message` int(11) NOT NULL DEFAULT '0' AFTER `raidswin`", |
|
1238 | - "MODIFY COLUMN `mnl_alliance` int(11) NOT NULL DEFAULT '0'", |
|
1239 | - "MODIFY COLUMN `mnl_joueur` int(11) NOT NULL DEFAULT '0'", |
|
1240 | - "MODIFY COLUMN `mnl_attaque` int(11) NOT NULL DEFAULT '0'", |
|
1241 | - "MODIFY COLUMN `mnl_spy` int(11) NOT NULL DEFAULT '0'", |
|
1242 | - "MODIFY COLUMN `mnl_exploit` int(11) NOT NULL DEFAULT '0'", |
|
1243 | - "MODIFY COLUMN `mnl_transport` int(11) NOT NULL DEFAULT '0'", |
|
1244 | - "MODIFY COLUMN `mnl_expedition` int(11) NOT NULL DEFAULT '0'", |
|
1245 | - "MODIFY COLUMN `mnl_buildlist` int(11) NOT NULL DEFAULT '0'", |
|
1246 | - "MODIFY COLUMN `msg_admin` bigint(11) unsigned DEFAULT '0'", |
|
1247 | -// "MODIFY COLUMN `b_tech_planet` int(11) NOT NULL DEFAULT '0' AFTER `msg_admin`", |
|
1248 | - "MODIFY COLUMN `deltime` int(10) unsigned DEFAULT '0'", |
|
1249 | - "MODIFY COLUMN `news_lastread` int(10) unsigned DEFAULT '0'", |
|
1250 | - "MODIFY COLUMN `total_rank` int(10) unsigned NOT NULL DEFAULT '0'", |
|
1251 | - "MODIFY COLUMN `total_points` bigint(20) unsigned NOT NULL DEFAULT '0'", |
|
1252 | - "MODIFY COLUMN `password` varchar(64) NOT NULL DEFAULT '' AFTER `total_points`", |
|
1253 | - "MODIFY COLUMN `email` varchar(64) NOT NULL DEFAULT '' AFTER `password`", |
|
1254 | - "MODIFY COLUMN `email_2` varchar(64) NOT NULL DEFAULT '' AFTER `email`", |
|
1255 | - "MODIFY COLUMN `lang` varchar(8) NOT NULL DEFAULT 'ru' AFTER `email_2`", |
|
1256 | - "MODIFY COLUMN `sex` char(1) DEFAULT NULL AFTER `lang`", |
|
1257 | - "MODIFY COLUMN `avatar` varchar(255) NOT NULL DEFAULT '' AFTER `sex`", |
|
1258 | - "MODIFY COLUMN `sign` mediumtext AFTER `avatar`", |
|
1259 | - "MODIFY COLUMN `id_planet` int(11) NOT NULL DEFAULT '0' AFTER `sign`", |
|
1260 | - "MODIFY COLUMN `galaxy` int(11) NOT NULL DEFAULT '0' AFTER `id_planet`", |
|
1261 | - "MODIFY COLUMN `system` int(11) NOT NULL DEFAULT '0' AFTER `galaxy`", |
|
1262 | - "MODIFY COLUMN `planet` int(11) NOT NULL DEFAULT '0' AFTER `system`", |
|
1263 | - "MODIFY COLUMN `current_planet` int(11) NOT NULL DEFAULT '0' AFTER `planet`", |
|
1264 | - "MODIFY COLUMN `user_agent` mediumtext NOT NULL AFTER `current_planet`", |
|
1265 | - "MODIFY COLUMN `user_lastip` varchar(250) DEFAULT NULL COMMENT 'User last IP' AFTER `user_agent`", |
|
1266 | - "MODIFY COLUMN `user_proxy` varchar(250) NOT NULL DEFAULT '' COMMENT 'User proxy (if any)' AFTER `user_lastip`", |
|
1267 | - "MODIFY COLUMN `register_time` int(10) unsigned DEFAULT '0' AFTER `user_proxy`", |
|
1268 | - "MODIFY COLUMN `onlinetime` int(10) unsigned DEFAULT '0' AFTER `register_time`", |
|
1269 | - "MODIFY COLUMN `dpath` varchar(255) NOT NULL DEFAULT '' AFTER `onlinetime`", |
|
1270 | - "MODIFY COLUMN `design` tinyint(4) unsigned NOT NULL DEFAULT '1' AFTER `dpath`", |
|
1271 | - "MODIFY COLUMN `noipcheck` tinyint(4) unsigned NOT NULL DEFAULT '1' AFTER `design`", |
|
1272 | - "MODIFY COLUMN `options` mediumtext COMMENT 'Packed user options' AFTER `noipcheck`", |
|
1273 | - "MODIFY COLUMN `planet_sort` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `options`", |
|
1274 | - "MODIFY COLUMN `planet_sort_order` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `planet_sort`", |
|
1275 | - "MODIFY COLUMN `spio_anz` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `planet_sort_order`", |
|
1276 | - "MODIFY COLUMN `settings_tooltiptime` tinyint(1) unsigned NOT NULL DEFAULT '5' AFTER `spio_anz`", |
|
1277 | - "MODIFY COLUMN `settings_fleetactions` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `settings_tooltiptime`", |
|
1278 | - "MODIFY COLUMN `settings_esp` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_allylogo`", |
|
1279 | - "MODIFY COLUMN `settings_wri` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_esp`", |
|
1280 | - "MODIFY COLUMN `settings_bud` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_wri`", |
|
1281 | - "MODIFY COLUMN `settings_mis` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_bud`", |
|
1282 | - "MODIFY COLUMN `settings_rep` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `settings_mis`", |
|
1283 | - ), strtoupper($update_tables['users']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
1199 | + upd_alter_table('users', array( |
|
1200 | + "MODIFY COLUMN `authlevel` tinyint unsigned NOT NULL DEFAULT '0' AFTER `username`", |
|
1201 | + "MODIFY COLUMN `vacation` int(11) unsigned DEFAULT '0' AFTER `authlevel`", |
|
1202 | + "MODIFY COLUMN `banaday` int(11) unsigned DEFAULT '0' AFTER `vacation`", |
|
1203 | + "MODIFY COLUMN `dark_matter` bigint(20) DEFAULT '0' AFTER `banaday`", |
|
1204 | + "MODIFY COLUMN `spy_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1205 | + "MODIFY COLUMN `computer_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1206 | + "MODIFY COLUMN `military_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1207 | + "MODIFY COLUMN `defence_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1208 | + "MODIFY COLUMN `shield_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1209 | + "MODIFY COLUMN `energy_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1210 | + "MODIFY COLUMN `hyperspace_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1211 | + "MODIFY COLUMN `combustion_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1212 | + "MODIFY COLUMN `impulse_motor_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1213 | + "MODIFY COLUMN `hyperspace_motor_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1214 | + "MODIFY COLUMN `laser_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1215 | + "MODIFY COLUMN `ionic_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1216 | + "MODIFY COLUMN `buster_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1217 | + "MODIFY COLUMN `intergalactic_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1218 | + "MODIFY COLUMN `expedition_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1219 | + "MODIFY COLUMN `colonisation_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1220 | + "MODIFY COLUMN `graviton_tech` SMALLINT UNSIGNED NOT NULL DEFAULT '0'", |
|
1221 | + "MODIFY COLUMN `player_artifact_list` text AFTER `graviton_tech`", |
|
1222 | + "MODIFY COLUMN `ally_id` bigint(20) unsigned DEFAULT NULL AFTER `player_artifact_list`", |
|
1223 | + "MODIFY COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
|
1224 | + "MODIFY COLUMN `ally_name` varchar(32) DEFAULT NULL AFTER `ally_tag`", |
|
1225 | + "MODIFY COLUMN `ally_register_time` int(11) NOT NULL DEFAULT '0' AFTER `ally_name`", |
|
1226 | + "MODIFY COLUMN `ally_rank_id` int(11) NOT NULL DEFAULT '0' AFTER `ally_register_time`", |
|
1227 | + "MODIFY COLUMN `player_que` text AFTER `ally_rank_id`", |
|
1228 | + "MODIFY COLUMN `lvl_minier` bigint(20) unsigned NOT NULL DEFAULT '1'", |
|
1229 | + "MODIFY COLUMN `xpminier` bigint(20) unsigned DEFAULT '0' AFTER `lvl_minier`", |
|
1230 | + "MODIFY COLUMN `player_rpg_tech_xp` bigint(20) unsigned NOT NULL DEFAULT '0'", |
|
1231 | + "MODIFY COLUMN `player_rpg_tech_level` bigint(20) unsigned NOT NULL DEFAULT '0'", |
|
1232 | + "MODIFY COLUMN `lvl_raid` bigint(20) unsigned NOT NULL DEFAULT '1' AFTER `player_rpg_tech_level`", |
|
1233 | + "MODIFY COLUMN `xpraid` bigint(20) unsigned DEFAULT '0'", |
|
1234 | + "MODIFY COLUMN `raids` bigint(20) unsigned DEFAULT '0'", |
|
1235 | + "MODIFY COLUMN `raidsloose` bigint(20) unsigned DEFAULT '0'", |
|
1236 | + "MODIFY COLUMN `raidswin` bigint(20) unsigned DEFAULT '0'", |
|
1237 | + "MODIFY COLUMN `new_message` int(11) NOT NULL DEFAULT '0' AFTER `raidswin`", |
|
1238 | + "MODIFY COLUMN `mnl_alliance` int(11) NOT NULL DEFAULT '0'", |
|
1239 | + "MODIFY COLUMN `mnl_joueur` int(11) NOT NULL DEFAULT '0'", |
|
1240 | + "MODIFY COLUMN `mnl_attaque` int(11) NOT NULL DEFAULT '0'", |
|
1241 | + "MODIFY COLUMN `mnl_spy` int(11) NOT NULL DEFAULT '0'", |
|
1242 | + "MODIFY COLUMN `mnl_exploit` int(11) NOT NULL DEFAULT '0'", |
|
1243 | + "MODIFY COLUMN `mnl_transport` int(11) NOT NULL DEFAULT '0'", |
|
1244 | + "MODIFY COLUMN `mnl_expedition` int(11) NOT NULL DEFAULT '0'", |
|
1245 | + "MODIFY COLUMN `mnl_buildlist` int(11) NOT NULL DEFAULT '0'", |
|
1246 | + "MODIFY COLUMN `msg_admin` bigint(11) unsigned DEFAULT '0'", |
|
1247 | + // "MODIFY COLUMN `b_tech_planet` int(11) NOT NULL DEFAULT '0' AFTER `msg_admin`", |
|
1248 | + "MODIFY COLUMN `deltime` int(10) unsigned DEFAULT '0'", |
|
1249 | + "MODIFY COLUMN `news_lastread` int(10) unsigned DEFAULT '0'", |
|
1250 | + "MODIFY COLUMN `total_rank` int(10) unsigned NOT NULL DEFAULT '0'", |
|
1251 | + "MODIFY COLUMN `total_points` bigint(20) unsigned NOT NULL DEFAULT '0'", |
|
1252 | + "MODIFY COLUMN `password` varchar(64) NOT NULL DEFAULT '' AFTER `total_points`", |
|
1253 | + "MODIFY COLUMN `email` varchar(64) NOT NULL DEFAULT '' AFTER `password`", |
|
1254 | + "MODIFY COLUMN `email_2` varchar(64) NOT NULL DEFAULT '' AFTER `email`", |
|
1255 | + "MODIFY COLUMN `lang` varchar(8) NOT NULL DEFAULT 'ru' AFTER `email_2`", |
|
1256 | + "MODIFY COLUMN `sex` char(1) DEFAULT NULL AFTER `lang`", |
|
1257 | + "MODIFY COLUMN `avatar` varchar(255) NOT NULL DEFAULT '' AFTER `sex`", |
|
1258 | + "MODIFY COLUMN `sign` mediumtext AFTER `avatar`", |
|
1259 | + "MODIFY COLUMN `id_planet` int(11) NOT NULL DEFAULT '0' AFTER `sign`", |
|
1260 | + "MODIFY COLUMN `galaxy` int(11) NOT NULL DEFAULT '0' AFTER `id_planet`", |
|
1261 | + "MODIFY COLUMN `system` int(11) NOT NULL DEFAULT '0' AFTER `galaxy`", |
|
1262 | + "MODIFY COLUMN `planet` int(11) NOT NULL DEFAULT '0' AFTER `system`", |
|
1263 | + "MODIFY COLUMN `current_planet` int(11) NOT NULL DEFAULT '0' AFTER `planet`", |
|
1264 | + "MODIFY COLUMN `user_agent` mediumtext NOT NULL AFTER `current_planet`", |
|
1265 | + "MODIFY COLUMN `user_lastip` varchar(250) DEFAULT NULL COMMENT 'User last IP' AFTER `user_agent`", |
|
1266 | + "MODIFY COLUMN `user_proxy` varchar(250) NOT NULL DEFAULT '' COMMENT 'User proxy (if any)' AFTER `user_lastip`", |
|
1267 | + "MODIFY COLUMN `register_time` int(10) unsigned DEFAULT '0' AFTER `user_proxy`", |
|
1268 | + "MODIFY COLUMN `onlinetime` int(10) unsigned DEFAULT '0' AFTER `register_time`", |
|
1269 | + "MODIFY COLUMN `dpath` varchar(255) NOT NULL DEFAULT '' AFTER `onlinetime`", |
|
1270 | + "MODIFY COLUMN `design` tinyint(4) unsigned NOT NULL DEFAULT '1' AFTER `dpath`", |
|
1271 | + "MODIFY COLUMN `noipcheck` tinyint(4) unsigned NOT NULL DEFAULT '1' AFTER `design`", |
|
1272 | + "MODIFY COLUMN `options` mediumtext COMMENT 'Packed user options' AFTER `noipcheck`", |
|
1273 | + "MODIFY COLUMN `planet_sort` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `options`", |
|
1274 | + "MODIFY COLUMN `planet_sort_order` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `planet_sort`", |
|
1275 | + "MODIFY COLUMN `spio_anz` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `planet_sort_order`", |
|
1276 | + "MODIFY COLUMN `settings_tooltiptime` tinyint(1) unsigned NOT NULL DEFAULT '5' AFTER `spio_anz`", |
|
1277 | + "MODIFY COLUMN `settings_fleetactions` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `settings_tooltiptime`", |
|
1278 | + "MODIFY COLUMN `settings_esp` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_allylogo`", |
|
1279 | + "MODIFY COLUMN `settings_wri` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_esp`", |
|
1280 | + "MODIFY COLUMN `settings_bud` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_wri`", |
|
1281 | + "MODIFY COLUMN `settings_mis` tinyint(1) unsigned NOT NULL DEFAULT '1' AFTER `settings_bud`", |
|
1282 | + "MODIFY COLUMN `settings_rep` tinyint(1) unsigned NOT NULL DEFAULT '0' AFTER `settings_mis`", |
|
1283 | + ), strtoupper($update_tables['users']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
1284 | 1284 | |
1285 | - upd_do_query('COMMIT;', true); |
|
1286 | - $new_version = 32; |
|
1285 | + upd_do_query('COMMIT;', true); |
|
1286 | + $new_version = 32; |
|
1287 | 1287 | |
1288 | - case 32: |
|
1289 | - upd_log_version_update(); |
|
1288 | + case 32: |
|
1289 | + upd_log_version_update(); |
|
1290 | 1290 | |
1291 | - upd_check_key('avatar_max_width', 128, !isset($config->avatar_max_width)); |
|
1292 | - upd_check_key('avatar_max_height', 128, !isset($config->avatar_max_height)); |
|
1291 | + upd_check_key('avatar_max_width', 128, !isset($config->avatar_max_width)); |
|
1292 | + upd_check_key('avatar_max_height', 128, !isset($config->avatar_max_height)); |
|
1293 | 1293 | |
1294 | - upd_alter_table('users', array( |
|
1295 | - "MODIFY COLUMN `avatar` tinyint(1) unsigned NOT NULL DEFAULT '0'", |
|
1296 | - ), strtoupper($update_tables['users']['avatar']['Type']) != 'TINYINT(1) UNSIGNED'); |
|
1294 | + upd_alter_table('users', array( |
|
1295 | + "MODIFY COLUMN `avatar` tinyint(1) unsigned NOT NULL DEFAULT '0'", |
|
1296 | + ), strtoupper($update_tables['users']['avatar']['Type']) != 'TINYINT(1) UNSIGNED'); |
|
1297 | 1297 | |
1298 | - upd_alter_table('alliance', array( |
|
1299 | - "MODIFY COLUMN `ally_image` tinyint(1) unsigned NOT NULL DEFAULT '0'", |
|
1300 | - ), strtoupper($update_tables['alliance']['ally_image']['Type']) != 'TINYINT(1) UNSIGNED'); |
|
1298 | + upd_alter_table('alliance', array( |
|
1299 | + "MODIFY COLUMN `ally_image` tinyint(1) unsigned NOT NULL DEFAULT '0'", |
|
1300 | + ), strtoupper($update_tables['alliance']['ally_image']['Type']) != 'TINYINT(1) UNSIGNED'); |
|
1301 | 1301 | |
1302 | - upd_alter_table('users', array( |
|
1303 | - "DROP COLUMN `settings_allylogo`", |
|
1304 | - ), isset($update_tables['users']['settings_allylogo'])); |
|
1302 | + upd_alter_table('users', array( |
|
1303 | + "DROP COLUMN `settings_allylogo`", |
|
1304 | + ), isset($update_tables['users']['settings_allylogo'])); |
|
1305 | 1305 | |
1306 | - if(!isset($update_tables['powerup'])) |
|
1307 | - { |
|
1308 | - upd_do_query("DROP TABLE IF EXISTS {$config->db_prefix}mercenaries;"); |
|
1306 | + if(!isset($update_tables['powerup'])) |
|
1307 | + { |
|
1308 | + upd_do_query("DROP TABLE IF EXISTS {$config->db_prefix}mercenaries;"); |
|
1309 | 1309 | |
1310 | - upd_create_table('powerup', |
|
1311 | - "( |
|
1310 | + upd_create_table('powerup', |
|
1311 | + "( |
|
1312 | 1312 | `powerup_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, |
1313 | 1313 | `powerup_user_id` bigint(20) UNSIGNED NULL DEFAULT NULL, |
1314 | 1314 | `powerup_planet_id` bigint(20) UNSIGNED NULL DEFAULT NULL, |
@@ -1327,38 +1327,38 @@ discard block |
||
1327 | 1327 | CONSTRAINT `FK_powerup_user_id` FOREIGN KEY (`powerup_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, |
1328 | 1328 | CONSTRAINT `FK_powerup_planet_id` FOREIGN KEY (`powerup_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
1329 | 1329 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1330 | - ); |
|
1330 | + ); |
|
1331 | 1331 | |
1332 | - upd_check_key('empire_mercenary_temporary', 0, !isset($config->empire_mercenary_temporary)); |
|
1333 | - upd_check_key('empire_mercenary_base_period', PERIOD_MONTH, !isset($config->empire_mercenary_base_period)); |
|
1332 | + upd_check_key('empire_mercenary_temporary', 0, !isset($config->empire_mercenary_temporary)); |
|
1333 | + upd_check_key('empire_mercenary_base_period', PERIOD_MONTH, !isset($config->empire_mercenary_base_period)); |
|
1334 | 1334 | |
1335 | - $update_query_template = "UPDATE {{users}} SET id = id %s WHERE id = %d LIMIT 1;"; |
|
1336 | - $user_list = upd_do_query("SELECT * FROM {{users}};"); |
|
1337 | - while($user_row = db_fetch($user_list)) |
|
1338 | - { |
|
1339 | - $update_query_str = ''; |
|
1340 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
1335 | + $update_query_template = "UPDATE {{users}} SET id = id %s WHERE id = %d LIMIT 1;"; |
|
1336 | + $user_list = upd_do_query("SELECT * FROM {{users}};"); |
|
1337 | + while($user_row = db_fetch($user_list)) |
|
1341 | 1338 | { |
1342 | - $mercenary_data_name = get_unit_param($mercenary_id, P_NAME); |
|
1343 | - if($mercenary_level = $user_row[$mercenary_data_name]) |
|
1339 | + $update_query_str = ''; |
|
1340 | + foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
1344 | 1341 | { |
1345 | - $update_query_str = ", `{$mercenary_data_name}` = 0"; |
|
1346 | - upd_do_query("DELETE FROM {{powerup}} WHERE powerup_user_id = {$user_row['id']} AND powerup_unit_id = {$mercenary_id} LIMIT 1;"); |
|
1347 | - upd_do_query("INSERT {{powerup}} SET powerup_user_id = {$user_row['id']}, powerup_unit_id = {$mercenary_id}, powerup_unit_level = {$mercenary_level};"); |
|
1342 | + $mercenary_data_name = get_unit_param($mercenary_id, P_NAME); |
|
1343 | + if($mercenary_level = $user_row[$mercenary_data_name]) |
|
1344 | + { |
|
1345 | + $update_query_str = ", `{$mercenary_data_name}` = 0"; |
|
1346 | + upd_do_query("DELETE FROM {{powerup}} WHERE powerup_user_id = {$user_row['id']} AND powerup_unit_id = {$mercenary_id} LIMIT 1;"); |
|
1347 | + upd_do_query("INSERT {{powerup}} SET powerup_user_id = {$user_row['id']}, powerup_unit_id = {$mercenary_id}, powerup_unit_level = {$mercenary_level};"); |
|
1348 | + } |
|
1348 | 1349 | } |
1349 | - } |
|
1350 | 1350 | |
1351 | - if($update_query_str) |
|
1352 | - { |
|
1353 | - upd_do_query(sprintf($update_query_template, $update_query_str, $user_row['id'])); |
|
1351 | + if($update_query_str) |
|
1352 | + { |
|
1353 | + upd_do_query(sprintf($update_query_template, $update_query_str, $user_row['id'])); |
|
1354 | + } |
|
1354 | 1355 | } |
1355 | 1356 | } |
1356 | - } |
|
1357 | 1357 | |
1358 | - if(!isset($update_tables['universe'])) |
|
1359 | - { |
|
1360 | - upd_create_table('universe', |
|
1361 | - "( |
|
1358 | + if(!isset($update_tables['universe'])) |
|
1359 | + { |
|
1360 | + upd_create_table('universe', |
|
1361 | + "( |
|
1362 | 1362 | `universe_galaxy` SMALLINT UNSIGNED NOT NULL DEFAULT '0', |
1363 | 1363 | `universe_system` SMALLINT UNSIGNED NOT NULL DEFAULT '0', |
1364 | 1364 | `universe_name` varchar(32) NOT NULL DEFAULT '', |
@@ -1366,197 +1366,197 @@ discard block |
||
1366 | 1366 | |
1367 | 1367 | PRIMARY KEY (`universe_galaxy`, `universe_system`) |
1368 | 1368 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1369 | - ); |
|
1370 | - |
|
1371 | - upd_check_key('uni_price_galaxy', 10000, !isset($config->uni_price_galaxy)); |
|
1372 | - upd_check_key('uni_price_system', 1000, !isset($config->uni_price_system)); |
|
1373 | - } |
|
1369 | + ); |
|
1374 | 1370 | |
1375 | - // ======================================================================== |
|
1376 | - // Ally player |
|
1377 | - // Adding config variable |
|
1378 | - upd_check_key('ali_bonus_members', 10, !isset($config->ali_bonus_members)); |
|
1371 | + upd_check_key('uni_price_galaxy', 10000, !isset($config->uni_price_galaxy)); |
|
1372 | + upd_check_key('uni_price_system', 1000, !isset($config->uni_price_system)); |
|
1373 | + } |
|
1379 | 1374 | |
1380 | - // ------------------------------------------------------------------------ |
|
1381 | - // Modifying tables |
|
1382 | - if(strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1383 | - { |
|
1384 | - upd_alter_table('users', array( |
|
1385 | - "ADD COLUMN user_as_ally BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1375 | + // ======================================================================== |
|
1376 | + // Ally player |
|
1377 | + // Adding config variable |
|
1378 | + upd_check_key('ali_bonus_members', 10, !isset($config->ali_bonus_members)); |
|
1386 | 1379 | |
1387 | - "ADD KEY `I_user_user_as_ally` (`user_as_ally`)", |
|
1380 | + // ------------------------------------------------------------------------ |
|
1381 | + // Modifying tables |
|
1382 | + if(strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') |
|
1383 | + { |
|
1384 | + upd_alter_table('users', array( |
|
1385 | + "ADD COLUMN user_as_ally BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1388 | 1386 | |
1389 | - "ADD CONSTRAINT `FK_user_user_as_ally` FOREIGN KEY (`user_as_ally`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1390 | - ), true); |
|
1387 | + "ADD KEY `I_user_user_as_ally` (`user_as_ally`)", |
|
1391 | 1388 | |
1392 | - upd_alter_table('alliance', array( |
|
1393 | - "ADD COLUMN ally_user_id BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1389 | + "ADD CONSTRAINT `FK_user_user_as_ally` FOREIGN KEY (`user_as_ally`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1390 | + ), true); |
|
1394 | 1391 | |
1395 | - "ADD KEY `I_ally_user_id` (`ally_user_id`)", |
|
1392 | + upd_alter_table('alliance', array( |
|
1393 | + "ADD COLUMN ally_user_id BIGINT(20) UNSIGNED DEFAULT NULL", |
|
1396 | 1394 | |
1397 | - "ADD CONSTRAINT `FK_ally_ally_user_id` FOREIGN KEY (`ally_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1398 | - ), true); |
|
1399 | - } |
|
1395 | + "ADD KEY `I_ally_user_id` (`ally_user_id`)", |
|
1400 | 1396 | |
1401 | - // ------------------------------------------------------------------------ |
|
1402 | - // Creating players for allies |
|
1403 | - $ally_row_list = doquery("SELECT `id`, `ally_tag` FROM {{alliance}} WHERE ally_user_id IS NULL;"); |
|
1404 | - while($ally_row = db_fetch($ally_row_list)) |
|
1405 | - { |
|
1406 | - $ally_user_name = db_escape("[{$ally_row['ally_tag']}]"); |
|
1407 | - doquery("INSERT INTO {{users}} SET `username` = '{$ally_user_name}', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_row['id']};"); |
|
1408 | - $ally_user_id = db_insert_id(); |
|
1409 | - doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_row['id']} LIMIT 1;"); |
|
1410 | - } |
|
1411 | - // Renaming old ally players TODO: Remove on release |
|
1412 | - upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.user_as_ally = a.id SET u.username = CONCAT('[', a.ally_tag, ']') WHERE u.user_as_ally IS NOT NULL AND u.username = '';"); |
|
1413 | - // Setting last online time to old ally players TODO: Remove on release |
|
1414 | - upd_do_query("UPDATE {{users}} SET `onlinetime` = " . SN_TIME_NOW . " WHERE onlinetime = 0;"); |
|
1415 | - |
|
1416 | - // ------------------------------------------------------------------------ |
|
1417 | - // Creating planets for allies |
|
1418 | - $ally_user_list = doquery("SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NOT NULL AND `id_planet` = 0;"); |
|
1419 | - while($ally_user_row = db_fetch($ally_user_list)) |
|
1420 | - { |
|
1421 | - $ally_planet_name = db_escape($ally_user_row['username']); |
|
1422 | - doquery("INSERT INTO {{planets}} SET `name` = '{$ally_planet_name}', `last_update` = " . SN_TIME_NOW . ", `id_owner` = {$ally_user_row['id']};"); |
|
1423 | - $ally_planet_id = db_insert_id(); |
|
1424 | - doquery("UPDATE {{users}} SET `id_planet` = {$ally_planet_id} WHERE `id` = {$ally_user_row['id']} LIMIT 1;"); |
|
1425 | - } |
|
1397 | + "ADD CONSTRAINT `FK_ally_ally_user_id` FOREIGN KEY (`ally_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1398 | + ), true); |
|
1399 | + } |
|
1426 | 1400 | |
1427 | - upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.ally_id = a.id SET u.ally_name = a.ally_name, u.ally_tag = a.ally_tag WHERE u.ally_id IS NOT NULL;"); |
|
1428 | - |
|
1429 | - upd_alter_table('users', array( |
|
1430 | - "DROP COLUMN `rpg_amiral`", |
|
1431 | - "DROP COLUMN `mrc_academic`", |
|
1432 | - "DROP COLUMN `rpg_espion`", |
|
1433 | - "DROP COLUMN `rpg_commandant`", |
|
1434 | - "DROP COLUMN `rpg_stockeur`", |
|
1435 | - "DROP COLUMN `rpg_destructeur`", |
|
1436 | - "DROP COLUMN `rpg_general`", |
|
1437 | - "DROP COLUMN `rpg_raideur`", |
|
1438 | - "DROP COLUMN `rpg_empereur`", |
|
1439 | - |
|
1440 | - "ADD COLUMN `metal` decimal(65,5) NOT NULL DEFAULT '0.00000'", |
|
1441 | - "ADD COLUMN `crystal` decimal(65,5) NOT NULL DEFAULT '0.00000'", |
|
1442 | - "ADD COLUMN `deuterium` decimal(65,5) NOT NULL DEFAULT '0.00000'", |
|
1443 | - ), $update_tables['users']['rpg_amiral']); |
|
1444 | - |
|
1445 | - |
|
1446 | - // ======================================================================== |
|
1447 | - // User que |
|
1448 | - // Adding db field |
|
1449 | - upd_alter_table('users', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'User que'", !$update_tables['users']['que']); |
|
1450 | - // Converting old data to new one and dropping old fields |
|
1451 | - if($update_tables['users']['b_tech_planet']) |
|
1452 | - { |
|
1453 | - $query = doquery("SELECT * FROM {{planets}} WHERE `b_tech_id` <> 0;"); |
|
1454 | - while($planet_row = db_fetch($query)) |
|
1401 | + // ------------------------------------------------------------------------ |
|
1402 | + // Creating players for allies |
|
1403 | + $ally_row_list = doquery("SELECT `id`, `ally_tag` FROM {{alliance}} WHERE ally_user_id IS NULL;"); |
|
1404 | + while($ally_row = db_fetch($ally_row_list)) |
|
1405 | + { |
|
1406 | + $ally_user_name = db_escape("[{$ally_row['ally_tag']}]"); |
|
1407 | + doquery("INSERT INTO {{users}} SET `username` = '{$ally_user_name}', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_row['id']};"); |
|
1408 | + $ally_user_id = db_insert_id(); |
|
1409 | + doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_row['id']} LIMIT 1;"); |
|
1410 | + } |
|
1411 | + // Renaming old ally players TODO: Remove on release |
|
1412 | + upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.user_as_ally = a.id SET u.username = CONCAT('[', a.ally_tag, ']') WHERE u.user_as_ally IS NOT NULL AND u.username = '';"); |
|
1413 | + // Setting last online time to old ally players TODO: Remove on release |
|
1414 | + upd_do_query("UPDATE {{users}} SET `onlinetime` = " . SN_TIME_NOW . " WHERE onlinetime = 0;"); |
|
1415 | + |
|
1416 | + // ------------------------------------------------------------------------ |
|
1417 | + // Creating planets for allies |
|
1418 | + $ally_user_list = doquery("SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NOT NULL AND `id_planet` = 0;"); |
|
1419 | + while($ally_user_row = db_fetch($ally_user_list)) |
|
1455 | 1420 | { |
1456 | - $que_item_string = "{$planet_row['b_tech_id']},1," . max(0, $planet_row['b_tech'] - SN_TIME_NOW) . "," . BUILD_CREATE . "," . QUE_RESEARCH; |
|
1457 | - doquery("UPDATE {{users}} SET `que` = '{$que_item_string}' WHERE `id` = {$planet_row['id_owner']} LIMIT 1;"); |
|
1421 | + $ally_planet_name = db_escape($ally_user_row['username']); |
|
1422 | + doquery("INSERT INTO {{planets}} SET `name` = '{$ally_planet_name}', `last_update` = " . SN_TIME_NOW . ", `id_owner` = {$ally_user_row['id']};"); |
|
1423 | + $ally_planet_id = db_insert_id(); |
|
1424 | + doquery("UPDATE {{users}} SET `id_planet` = {$ally_planet_id} WHERE `id` = {$ally_user_row['id']} LIMIT 1;"); |
|
1458 | 1425 | } |
1459 | 1426 | |
1460 | - upd_alter_table('planets', array( |
|
1461 | - "DROP COLUMN `b_tech`", |
|
1462 | - "DROP COLUMN `b_tech_id`", |
|
1463 | - ), $update_tables['planets']['b_tech']); |
|
1427 | + upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.ally_id = a.id SET u.ally_name = a.ally_name, u.ally_tag = a.ally_tag WHERE u.ally_id IS NOT NULL;"); |
|
1464 | 1428 | |
1465 | - upd_alter_table('users', "DROP COLUMN `b_tech_planet`", $update_tables['users']['b_tech_planet']); |
|
1466 | - } |
|
1429 | + upd_alter_table('users', array( |
|
1430 | + "DROP COLUMN `rpg_amiral`", |
|
1431 | + "DROP COLUMN `mrc_academic`", |
|
1432 | + "DROP COLUMN `rpg_espion`", |
|
1433 | + "DROP COLUMN `rpg_commandant`", |
|
1434 | + "DROP COLUMN `rpg_stockeur`", |
|
1435 | + "DROP COLUMN `rpg_destructeur`", |
|
1436 | + "DROP COLUMN `rpg_general`", |
|
1437 | + "DROP COLUMN `rpg_raideur`", |
|
1438 | + "DROP COLUMN `rpg_empereur`", |
|
1439 | + |
|
1440 | + "ADD COLUMN `metal` decimal(65,5) NOT NULL DEFAULT '0.00000'", |
|
1441 | + "ADD COLUMN `crystal` decimal(65,5) NOT NULL DEFAULT '0.00000'", |
|
1442 | + "ADD COLUMN `deuterium` decimal(65,5) NOT NULL DEFAULT '0.00000'", |
|
1443 | + ), $update_tables['users']['rpg_amiral']); |
|
1444 | + |
|
1445 | + |
|
1446 | + // ======================================================================== |
|
1447 | + // User que |
|
1448 | + // Adding db field |
|
1449 | + upd_alter_table('users', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'User que'", !$update_tables['users']['que']); |
|
1450 | + // Converting old data to new one and dropping old fields |
|
1451 | + if($update_tables['users']['b_tech_planet']) |
|
1452 | + { |
|
1453 | + $query = doquery("SELECT * FROM {{planets}} WHERE `b_tech_id` <> 0;"); |
|
1454 | + while($planet_row = db_fetch($query)) |
|
1455 | + { |
|
1456 | + $que_item_string = "{$planet_row['b_tech_id']},1," . max(0, $planet_row['b_tech'] - SN_TIME_NOW) . "," . BUILD_CREATE . "," . QUE_RESEARCH; |
|
1457 | + doquery("UPDATE {{users}} SET `que` = '{$que_item_string}' WHERE `id` = {$planet_row['id_owner']} LIMIT 1;"); |
|
1458 | + } |
|
1467 | 1459 | |
1468 | - if(!$update_tables['powerup']['powerup_category']) |
|
1469 | - { |
|
1470 | - upd_alter_table('powerup', "ADD COLUMN `powerup_category` SMALLINT NOT NULL DEFAULT 0 AFTER `powerup_planet_id`", !$update_tables['powerup']['powerup_category']); |
|
1460 | + upd_alter_table('planets', array( |
|
1461 | + "DROP COLUMN `b_tech`", |
|
1462 | + "DROP COLUMN `b_tech_id`", |
|
1463 | + ), $update_tables['planets']['b_tech']); |
|
1471 | 1464 | |
1472 | - doquery("UPDATE {{powerup}} SET powerup_category = " . BONUS_MERCENARY); |
|
1473 | - } |
|
1465 | + upd_alter_table('users', "DROP COLUMN `b_tech_planet`", $update_tables['users']['b_tech_planet']); |
|
1466 | + } |
|
1467 | + |
|
1468 | + if(!$update_tables['powerup']['powerup_category']) |
|
1469 | + { |
|
1470 | + upd_alter_table('powerup', "ADD COLUMN `powerup_category` SMALLINT NOT NULL DEFAULT 0 AFTER `powerup_planet_id`", !$update_tables['powerup']['powerup_category']); |
|
1471 | + |
|
1472 | + doquery("UPDATE {{powerup}} SET powerup_category = " . BONUS_MERCENARY); |
|
1473 | + } |
|
1474 | 1474 | |
1475 | - upd_check_key('rpg_cost_info', 10000, !isset($config->rpg_cost_info)); |
|
1476 | - upd_check_key('tpl_minifier', 0, !isset($config->tpl_minifier)); |
|
1475 | + upd_check_key('rpg_cost_info', 10000, !isset($config->rpg_cost_info)); |
|
1476 | + upd_check_key('tpl_minifier', 0, !isset($config->tpl_minifier)); |
|
1477 | 1477 | |
1478 | - upd_check_key('server_updater_check_auto', 0, !isset($config->server_updater_check_auto)); |
|
1479 | - upd_check_key('server_updater_check_period', PERIOD_DAY, !isset($config->server_updater_check_period)); |
|
1480 | - upd_check_key('server_updater_check_last', 0, !isset($config->server_updater_check_last)); |
|
1481 | - upd_check_key('server_updater_check_result', SNC_VER_NEVER, !isset($config->server_updater_check_result)); |
|
1482 | - upd_check_key('server_updater_key', '', !isset($config->server_updater_key)); |
|
1483 | - upd_check_key('server_updater_id', 0, !isset($config->server_updater_id)); |
|
1478 | + upd_check_key('server_updater_check_auto', 0, !isset($config->server_updater_check_auto)); |
|
1479 | + upd_check_key('server_updater_check_period', PERIOD_DAY, !isset($config->server_updater_check_period)); |
|
1480 | + upd_check_key('server_updater_check_last', 0, !isset($config->server_updater_check_last)); |
|
1481 | + upd_check_key('server_updater_check_result', SNC_VER_NEVER, !isset($config->server_updater_check_result)); |
|
1482 | + upd_check_key('server_updater_key', '', !isset($config->server_updater_key)); |
|
1483 | + upd_check_key('server_updater_id', 0, !isset($config->server_updater_id)); |
|
1484 | 1484 | |
1485 | - upd_check_key('ali_bonus_algorithm', 0, !isset($config->ali_bonus_algorithm)); |
|
1486 | - upd_check_key('ali_bonus_divisor', 10000000, !isset($config->ali_bonus_divisor)); |
|
1487 | - upd_check_key('ali_bonus_brackets', 10, !isset($config->ali_bonus_brackets)); |
|
1488 | - upd_check_key('ali_bonus_brackets_divisor', 50, !isset($config->ali_bonus_brackets_divisor)); |
|
1485 | + upd_check_key('ali_bonus_algorithm', 0, !isset($config->ali_bonus_algorithm)); |
|
1486 | + upd_check_key('ali_bonus_divisor', 10000000, !isset($config->ali_bonus_divisor)); |
|
1487 | + upd_check_key('ali_bonus_brackets', 10, !isset($config->ali_bonus_brackets)); |
|
1488 | + upd_check_key('ali_bonus_brackets_divisor', 50, !isset($config->ali_bonus_brackets_divisor)); |
|
1489 | 1489 | |
1490 | - if(!$config->db_loadItem('rpg_flt_explore')) |
|
1491 | - { |
|
1492 | - $inflation_rate = 1000; |
|
1490 | + if(!$config->db_loadItem('rpg_flt_explore')) |
|
1491 | + { |
|
1492 | + $inflation_rate = 1000; |
|
1493 | 1493 | |
1494 | - $config->db_saveItem('rpg_cost_banker', $config->rpg_cost_banker * $inflation_rate); |
|
1495 | - $config->db_saveItem('rpg_cost_exchange', $config->rpg_cost_exchange * $inflation_rate); |
|
1496 | - $config->db_saveItem('rpg_cost_pawnshop', $config->rpg_cost_pawnshop * $inflation_rate); |
|
1497 | - $config->db_saveItem('rpg_cost_scraper', $config->rpg_cost_scraper * $inflation_rate); |
|
1498 | - $config->db_saveItem('rpg_cost_stockman', $config->rpg_cost_stockman * $inflation_rate); |
|
1499 | - $config->db_saveItem('rpg_cost_trader', $config->rpg_cost_trader * $inflation_rate); |
|
1494 | + $config->db_saveItem('rpg_cost_banker', $config->rpg_cost_banker * $inflation_rate); |
|
1495 | + $config->db_saveItem('rpg_cost_exchange', $config->rpg_cost_exchange * $inflation_rate); |
|
1496 | + $config->db_saveItem('rpg_cost_pawnshop', $config->rpg_cost_pawnshop * $inflation_rate); |
|
1497 | + $config->db_saveItem('rpg_cost_scraper', $config->rpg_cost_scraper * $inflation_rate); |
|
1498 | + $config->db_saveItem('rpg_cost_stockman', $config->rpg_cost_stockman * $inflation_rate); |
|
1499 | + $config->db_saveItem('rpg_cost_trader', $config->rpg_cost_trader * $inflation_rate); |
|
1500 | 1500 | |
1501 | - $config->db_saveItem('rpg_exchange_darkMatter', $config->rpg_exchange_darkMatter / $inflation_rate * 4); |
|
1501 | + $config->db_saveItem('rpg_exchange_darkMatter', $config->rpg_exchange_darkMatter / $inflation_rate * 4); |
|
1502 | 1502 | |
1503 | - $config->db_saveItem('rpg_flt_explore', $inflation_rate); |
|
1503 | + $config->db_saveItem('rpg_flt_explore', $inflation_rate); |
|
1504 | 1504 | |
1505 | - doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` * {$inflation_rate};"); |
|
1505 | + doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` * {$inflation_rate};"); |
|
1506 | 1506 | |
1507 | - $query = doquery("SELECT * FROM {{quest}}"); |
|
1508 | - while($row = db_fetch($query)) |
|
1509 | - { |
|
1510 | - $query_add = ''; |
|
1511 | - $quest_reward_list = explode(';', $row['quest_rewards']); |
|
1512 | - foreach($quest_reward_list as &$quest_reward) |
|
1507 | + $query = doquery("SELECT * FROM {{quest}}"); |
|
1508 | + while($row = db_fetch($query)) |
|
1513 | 1509 | { |
1514 | - list($reward_resource, $reward_amount) = explode(',', $quest_reward); |
|
1515 | - if($reward_resource == RES_DARK_MATTER) |
|
1510 | + $query_add = ''; |
|
1511 | + $quest_reward_list = explode(';', $row['quest_rewards']); |
|
1512 | + foreach($quest_reward_list as &$quest_reward) |
|
1516 | 1513 | { |
1517 | - $quest_reward = "{$reward_resource}," . $reward_amount * 1000; |
|
1514 | + list($reward_resource, $reward_amount) = explode(',', $quest_reward); |
|
1515 | + if($reward_resource == RES_DARK_MATTER) |
|
1516 | + { |
|
1517 | + $quest_reward = "{$reward_resource}," . $reward_amount * 1000; |
|
1518 | + } |
|
1519 | + } |
|
1520 | + $new_rewards = implode(';', $quest_reward_list); |
|
1521 | + if($new_rewards != $row['quest_rewards']) |
|
1522 | + { |
|
1523 | + doquery("UPDATE {{quest}} SET `quest_rewards` = '{$new_rewards}' WHERE quest_id = {$row['quest_id']} LIMIT 1;"); |
|
1518 | 1524 | } |
1519 | - } |
|
1520 | - $new_rewards = implode(';', $quest_reward_list); |
|
1521 | - if($new_rewards != $row['quest_rewards']) |
|
1522 | - { |
|
1523 | - doquery("UPDATE {{quest}} SET `quest_rewards` = '{$new_rewards}' WHERE quest_id = {$row['quest_id']} LIMIT 1;"); |
|
1524 | 1525 | } |
1525 | 1526 | } |
1526 | - } |
|
1527 | 1527 | |
1528 | - upd_check_key('rpg_bonus_minimum', 10000, !isset($config->rpg_bonus_minimum)); |
|
1529 | - upd_check_key('rpg_bonus_divisor', |
|
1530 | - !isset($config->rpg_bonus_divisor) ? 10 : ($config->rpg_bonus_divisor >= 1000 ? floor($config->rpg_bonus_divisor / 1000) : $config->rpg_bonus_divisor), |
|
1531 | - !isset($config->rpg_bonus_divisor) || $config->rpg_bonus_divisor >= 1000); |
|
1528 | + upd_check_key('rpg_bonus_minimum', 10000, !isset($config->rpg_bonus_minimum)); |
|
1529 | + upd_check_key('rpg_bonus_divisor', |
|
1530 | + !isset($config->rpg_bonus_divisor) ? 10 : ($config->rpg_bonus_divisor >= 1000 ? floor($config->rpg_bonus_divisor / 1000) : $config->rpg_bonus_divisor), |
|
1531 | + !isset($config->rpg_bonus_divisor) || $config->rpg_bonus_divisor >= 1000); |
|
1532 | 1532 | |
1533 | - upd_check_key('var_news_last', 0, !isset($config->var_news_last)); |
|
1533 | + upd_check_key('var_news_last', 0, !isset($config->var_news_last)); |
|
1534 | 1534 | |
1535 | - upd_do_query('COMMIT;', true); |
|
1536 | - $new_version = 33; |
|
1535 | + upd_do_query('COMMIT;', true); |
|
1536 | + $new_version = 33; |
|
1537 | 1537 | |
1538 | - case 33: |
|
1539 | - upd_log_version_update(); |
|
1538 | + case 33: |
|
1539 | + upd_log_version_update(); |
|
1540 | 1540 | |
1541 | - upd_alter_table('users', array( |
|
1542 | - "ADD `user_birthday` DATE DEFAULT NULL COMMENT 'User birthday'", |
|
1543 | - "ADD `user_birthday_celebrated` DATE DEFAULT NULL COMMENT 'Last time where user got birthday gift'", |
|
1541 | + upd_alter_table('users', array( |
|
1542 | + "ADD `user_birthday` DATE DEFAULT NULL COMMENT 'User birthday'", |
|
1543 | + "ADD `user_birthday_celebrated` DATE DEFAULT NULL COMMENT 'Last time where user got birthday gift'", |
|
1544 | 1544 | |
1545 | - "ADD KEY `I_user_birthday` (`user_birthday`, `user_birthday_celebrated`)", |
|
1546 | - ), !$update_tables['users']['user_birthday']); |
|
1545 | + "ADD KEY `I_user_birthday` (`user_birthday`, `user_birthday_celebrated`)", |
|
1546 | + ), !$update_tables['users']['user_birthday']); |
|
1547 | 1547 | |
1548 | - upd_check_key('user_birthday_gift', 0, !isset($config->user_birthday_gift)); |
|
1549 | - upd_check_key('user_birthday_range', 30, !isset($config->user_birthday_range)); |
|
1550 | - upd_check_key('user_birthday_celebrate', 0, !isset($config->user_birthday_celebrate)); |
|
1548 | + upd_check_key('user_birthday_gift', 0, !isset($config->user_birthday_gift)); |
|
1549 | + upd_check_key('user_birthday_range', 30, !isset($config->user_birthday_range)); |
|
1550 | + upd_check_key('user_birthday_celebrate', 0, !isset($config->user_birthday_celebrate)); |
|
1551 | 1551 | |
1552 | - if(!isset($update_tables['payment'])) |
|
1553 | - { |
|
1554 | - upd_alter_table('users', array( |
|
1555 | - "ADD KEY `I_user_id_name` (`id`, `username`)", |
|
1556 | - ), !$update_indexes['users']['I_user_id_name']); |
|
1552 | + if(!isset($update_tables['payment'])) |
|
1553 | + { |
|
1554 | + upd_alter_table('users', array( |
|
1555 | + "ADD KEY `I_user_id_name` (`id`, `username`)", |
|
1556 | + ), !$update_indexes['users']['I_user_id_name']); |
|
1557 | 1557 | |
1558 | - upd_create_table('payment', |
|
1559 | - "( |
|
1558 | + upd_create_table('payment', |
|
1559 | + "( |
|
1560 | 1560 | `payment_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Internal payment ID', |
1561 | 1561 | `payment_user_id` BIGINT(20) UNSIGNED DEFAULT NULL, |
1562 | 1562 | `payment_user_name` VARCHAR(64) DEFAULT NULL, |
@@ -1576,177 +1576,177 @@ discard block |
||
1576 | 1576 | |
1577 | 1577 | CONSTRAINT `FK_payment_user` FOREIGN KEY (`payment_user_id`, `payment_user_name`) REFERENCES `{$config->db_prefix}users` (`id`, `username`) ON UPDATE CASCADE ON DELETE NO ACTION |
1578 | 1578 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1579 | - ); |
|
1579 | + ); |
|
1580 | 1580 | |
1581 | - upd_check_key('payment_currency_default', 'UAH', !isset($config->payment_currency_default)); |
|
1582 | - } |
|
1583 | - upd_check_key('payment_lot_size', 1000, !isset($config->payment_lot_size)); |
|
1584 | - upd_check_key('payment_lot_price', 1, !isset($config->payment_lot_price)); |
|
1581 | + upd_check_key('payment_currency_default', 'UAH', !isset($config->payment_currency_default)); |
|
1582 | + } |
|
1583 | + upd_check_key('payment_lot_size', 1000, !isset($config->payment_lot_size)); |
|
1584 | + upd_check_key('payment_lot_price', 1, !isset($config->payment_lot_price)); |
|
1585 | 1585 | |
1586 | - // Updating category for Mercenaries |
|
1587 | - upd_do_query("UPDATE {{powerup}} SET powerup_category = " . UNIT_MERCENARIES . " WHERE powerup_unit_id > 600 AND powerup_unit_id < 700;"); |
|
1586 | + // Updating category for Mercenaries |
|
1587 | + upd_do_query("UPDATE {{powerup}} SET powerup_category = " . UNIT_MERCENARIES . " WHERE powerup_unit_id > 600 AND powerup_unit_id < 700;"); |
|
1588 | 1588 | |
1589 | - // Convert Destructor to Death Star schematic |
|
1590 | - upd_do_query("UPDATE {{powerup}} |
|
1589 | + // Convert Destructor to Death Star schematic |
|
1590 | + upd_do_query("UPDATE {{powerup}} |
|
1591 | 1591 | SET powerup_time_start = 0, powerup_time_finish = 0, powerup_category = " . UNIT_PLANS . ", powerup_unit_id = " . UNIT_PLAN_SHIP_DEATH_STAR . " |
1592 | 1592 | WHERE (powerup_time_start = 0 OR powerup_time_finish >= UNIX_TIMESTAMP()) AND powerup_unit_id = 612;"); |
1593 | - // Convert Assasin to SuperNova schematic |
|
1594 | - upd_do_query("UPDATE {{powerup}} |
|
1593 | + // Convert Assasin to SuperNova schematic |
|
1594 | + upd_do_query("UPDATE {{powerup}} |
|
1595 | 1595 | SET powerup_time_start = 0, powerup_time_finish = 0, powerup_category = " . UNIT_PLANS . ", powerup_unit_id = " . UNIT_PLAN_SHIP_SUPERNOVA . " |
1596 | 1596 | WHERE (powerup_time_start = 0 OR powerup_time_finish >= UNIX_TIMESTAMP()) AND powerup_unit_id = 614;"); |
1597 | 1597 | |
1598 | - upd_alter_table('iraks', array( |
|
1599 | - "ADD `fleet_start_type` SMALLINT NOT NULL DEFAULT 1", |
|
1600 | - "ADD `fleet_end_type` SMALLINT NOT NULL DEFAULT 1", |
|
1601 | - ), !$update_tables['iraks']['fleet_start_type']); |
|
1602 | - |
|
1603 | - |
|
1604 | - if(!$update_tables['payment']['payment_status']) |
|
1605 | - { |
|
1606 | - upd_alter_table('payment', array( |
|
1607 | - "ADD COLUMN `payment_status` INT DEFAULT 0 COMMENT 'Payment status' AFTER `payment_id`", |
|
1598 | + upd_alter_table('iraks', array( |
|
1599 | + "ADD `fleet_start_type` SMALLINT NOT NULL DEFAULT 1", |
|
1600 | + "ADD `fleet_end_type` SMALLINT NOT NULL DEFAULT 1", |
|
1601 | + ), !$update_tables['iraks']['fleet_start_type']); |
|
1608 | 1602 | |
1609 | - "CHANGE COLUMN `payment_dm` `payment_dark_matter_paid` DECIMAL(65,0) DEFAULT 0 COMMENT 'Real DM paid for'", |
|
1610 | - "ADD COLUMN `payment_dark_matter_gained` DECIMAL(65,0) DEFAULT 0 COMMENT 'DM gained by player (with bonuses)' AFTER `payment_dark_matter_paid`", |
|
1611 | 1603 | |
1612 | - "CHANGE COLUMN `payment_internal_id` `payment_external_id` VARCHAR(255) DEFAULT '' COMMENT 'External payment ID in payment system'", |
|
1613 | - "CHANGE COLUMN `payment_internal_date` `payment_external_date` DATETIME COMMENT 'External payment timestamp in payment system'", |
|
1614 | - "ADD COLUMN `payment_external_lots` decimal(65,5) NOT NULL DEFAULT '0.00000' COMMENT 'Payment system lot amount'", |
|
1615 | - "ADD COLUMN `payment_external_amount` decimal(65,5) NOT NULL DEFAULT '0.00000' COMMENT 'Money incoming from payment system'", |
|
1616 | - "ADD COLUMN `payment_external_currency` VARCHAR(3) NOT NULL DEFAULT '' COMMENT 'Payment system currency'", |
|
1617 | - ), !$update_tables['payment']['payment_status']); |
|
1618 | - } |
|
1604 | + if(!$update_tables['payment']['payment_status']) |
|
1605 | + { |
|
1606 | + upd_alter_table('payment', array( |
|
1607 | + "ADD COLUMN `payment_status` INT DEFAULT 0 COMMENT 'Payment status' AFTER `payment_id`", |
|
1608 | + |
|
1609 | + "CHANGE COLUMN `payment_dm` `payment_dark_matter_paid` DECIMAL(65,0) DEFAULT 0 COMMENT 'Real DM paid for'", |
|
1610 | + "ADD COLUMN `payment_dark_matter_gained` DECIMAL(65,0) DEFAULT 0 COMMENT 'DM gained by player (with bonuses)' AFTER `payment_dark_matter_paid`", |
|
1611 | + |
|
1612 | + "CHANGE COLUMN `payment_internal_id` `payment_external_id` VARCHAR(255) DEFAULT '' COMMENT 'External payment ID in payment system'", |
|
1613 | + "CHANGE COLUMN `payment_internal_date` `payment_external_date` DATETIME COMMENT 'External payment timestamp in payment system'", |
|
1614 | + "ADD COLUMN `payment_external_lots` decimal(65,5) NOT NULL DEFAULT '0.00000' COMMENT 'Payment system lot amount'", |
|
1615 | + "ADD COLUMN `payment_external_amount` decimal(65,5) NOT NULL DEFAULT '0.00000' COMMENT 'Money incoming from payment system'", |
|
1616 | + "ADD COLUMN `payment_external_currency` VARCHAR(3) NOT NULL DEFAULT '' COMMENT 'Payment system currency'", |
|
1617 | + ), !$update_tables['payment']['payment_status']); |
|
1618 | + } |
|
1619 | 1619 | |
1620 | - upd_do_query("UPDATE {{powerup}} SET powerup_time_start = 0, powerup_time_finish = 0 WHERE powerup_category = " . UNIT_PLANS . ";"); |
|
1620 | + upd_do_query("UPDATE {{powerup}} SET powerup_time_start = 0, powerup_time_finish = 0 WHERE powerup_category = " . UNIT_PLANS . ";"); |
|
1621 | 1621 | |
1622 | - upd_check_key('server_start_date', date('d.m.Y', SN_TIME_NOW), !isset($config->server_start_date)); |
|
1623 | - upd_check_key('server_que_length_structures', 5, !isset($config->server_que_length_structures)); |
|
1624 | - upd_check_key('server_que_length_hangar', 5, !isset($config->server_que_length_hangar)); |
|
1622 | + upd_check_key('server_start_date', date('d.m.Y', SN_TIME_NOW), !isset($config->server_start_date)); |
|
1623 | + upd_check_key('server_que_length_structures', 5, !isset($config->server_que_length_structures)); |
|
1624 | + upd_check_key('server_que_length_hangar', 5, !isset($config->server_que_length_hangar)); |
|
1625 | 1625 | |
1626 | - upd_check_key('chat_highlight_moderator', '<span class="nick_moderator">$1</span>', $config->chat_highlight_admin == '<font color=green>$1</font>'); |
|
1627 | - upd_check_key('chat_highlight_operator', '<span class="nick_operator">$1</span>', $config->chat_highlight_admin == '<font color=red>$1</font>'); |
|
1628 | - upd_check_key('chat_highlight_admin', '<span class="nick_admin">$1</span>', $config->chat_highlight_admin == '<font color=purple>$1</font>'); |
|
1626 | + upd_check_key('chat_highlight_moderator', '<span class="nick_moderator">$1</span>', $config->chat_highlight_admin == '<font color=green>$1</font>'); |
|
1627 | + upd_check_key('chat_highlight_operator', '<span class="nick_operator">$1</span>', $config->chat_highlight_admin == '<font color=red>$1</font>'); |
|
1628 | + upd_check_key('chat_highlight_admin', '<span class="nick_admin">$1</span>', $config->chat_highlight_admin == '<font color=purple>$1</font>'); |
|
1629 | 1629 | |
1630 | - upd_check_key('chat_highlight_premium', '<span class="nick_premium">$1</span>', !isset($config->chat_highlight_premium)); |
|
1630 | + upd_check_key('chat_highlight_premium', '<span class="nick_premium">$1</span>', !isset($config->chat_highlight_premium)); |
|
1631 | 1631 | |
1632 | - upd_do_query("UPDATE {{planets}} SET `PLANET_GOVERNOR_LEVEL` = CEILING(`PLANET_GOVERNOR_LEVEL`/2) WHERE PLANET_GOVERNOR_ID = " . MRC_ENGINEER . " AND `PLANET_GOVERNOR_LEVEL` > 8;"); |
|
1632 | + upd_do_query("UPDATE {{planets}} SET `PLANET_GOVERNOR_LEVEL` = CEILING(`PLANET_GOVERNOR_LEVEL`/2) WHERE PLANET_GOVERNOR_ID = " . MRC_ENGINEER . " AND `PLANET_GOVERNOR_LEVEL` > 8;"); |
|
1633 | 1633 | |
1634 | 1634 | |
1635 | - upd_do_query('COMMIT;', true); |
|
1636 | - $new_version = 34; |
|
1635 | + upd_do_query('COMMIT;', true); |
|
1636 | + $new_version = 34; |
|
1637 | 1637 | |
1638 | - case 34: |
|
1639 | - upd_log_version_update(); |
|
1638 | + case 34: |
|
1639 | + upd_log_version_update(); |
|
1640 | 1640 | |
1641 | - upd_alter_table('planets', array( |
|
1642 | - "ADD COLUMN `planet_teleport_next` INT(11) NOT NULL DEFAULT 0 COMMENT 'Next teleport time'", |
|
1643 | - ), !$update_tables['planets']['planet_teleport_next']); |
|
1641 | + upd_alter_table('planets', array( |
|
1642 | + "ADD COLUMN `planet_teleport_next` INT(11) NOT NULL DEFAULT 0 COMMENT 'Next teleport time'", |
|
1643 | + ), !$update_tables['planets']['planet_teleport_next']); |
|
1644 | 1644 | |
1645 | - upd_check_key('planet_teleport_cost', 50000, !isset($config->planet_teleport_cost)); |
|
1646 | - upd_check_key('planet_teleport_timeout', PERIOD_DAY * 1, !isset($config->planet_teleport_timeout)); |
|
1645 | + upd_check_key('planet_teleport_cost', 50000, !isset($config->planet_teleport_cost)); |
|
1646 | + upd_check_key('planet_teleport_timeout', PERIOD_DAY * 1, !isset($config->planet_teleport_timeout)); |
|
1647 | 1647 | |
1648 | - upd_check_key('planet_capital_cost', 25000, !isset($config->planet_capital_cost)); |
|
1648 | + upd_check_key('planet_capital_cost', 25000, !isset($config->planet_capital_cost)); |
|
1649 | 1649 | |
1650 | - upd_alter_table('users', array( |
|
1651 | - "ADD COLUMN `player_race` INT(11) NOT NULL DEFAULT 0 COMMENT 'Player\'s race'", |
|
1652 | - ), !$update_tables['users']['player_race']); |
|
1650 | + upd_alter_table('users', array( |
|
1651 | + "ADD COLUMN `player_race` INT(11) NOT NULL DEFAULT 0 COMMENT 'Player\'s race'", |
|
1652 | + ), !$update_tables['users']['player_race']); |
|
1653 | 1653 | |
1654 | - upd_alter_table('chat', array( |
|
1655 | - "MODIFY COLUMN `user` TEXT COMMENT 'Chat message user name'", |
|
1656 | - ), strtoupper($update_tables['chat']['user']['Type']) != 'TEXT'); |
|
1654 | + upd_alter_table('chat', array( |
|
1655 | + "MODIFY COLUMN `user` TEXT COMMENT 'Chat message user name'", |
|
1656 | + ), strtoupper($update_tables['chat']['user']['Type']) != 'TEXT'); |
|
1657 | 1657 | |
1658 | - upd_alter_table('planets', array( |
|
1659 | - "ADD `ship_sattelite_sloth` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Terran Sloth'", |
|
1660 | - "ADD `ship_bomber_envy` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Lunar Envy'", |
|
1661 | - "ADD `ship_recycler_gluttony` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Mercurian Gluttony'", |
|
1662 | - "ADD `ship_fighter_wrath` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Venerian Wrath'", |
|
1663 | - "ADD `ship_battleship_pride` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Martian Pride'", |
|
1664 | - "ADD `ship_cargo_greed` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Republican Greed'", |
|
1665 | - ), !$update_tables['planets']['ship_sattelite_sloth']); |
|
1658 | + upd_alter_table('planets', array( |
|
1659 | + "ADD `ship_sattelite_sloth` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Terran Sloth'", |
|
1660 | + "ADD `ship_bomber_envy` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Lunar Envy'", |
|
1661 | + "ADD `ship_recycler_gluttony` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Mercurian Gluttony'", |
|
1662 | + "ADD `ship_fighter_wrath` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Venerian Wrath'", |
|
1663 | + "ADD `ship_battleship_pride` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Martian Pride'", |
|
1664 | + "ADD `ship_cargo_greed` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Republican Greed'", |
|
1665 | + ), !$update_tables['planets']['ship_sattelite_sloth']); |
|
1666 | 1666 | |
1667 | - upd_alter_table('planets', array( |
|
1668 | - "ADD `ship_sattelite_sloth_porcent` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' COMMENT 'Terran Sloth production'", |
|
1669 | - "ADD KEY `I_ship_sattelite_sloth` (`ship_sattelite_sloth`, `id_level`)", |
|
1670 | - "ADD KEY `I_ship_bomber_envy` (`ship_bomber_envy`, `id_level`)", |
|
1671 | - "ADD KEY `I_ship_recycler_gluttony` (`ship_recycler_gluttony`, `id_level`)", |
|
1672 | - "ADD KEY `I_ship_fighter_wrath` (`ship_fighter_wrath`, `id_level`)", |
|
1673 | - "ADD KEY `I_ship_battleship_pride` (`ship_battleship_pride`, `id_level`)", |
|
1674 | - "ADD KEY `I_ship_cargo_greed` (`ship_cargo_greed`, `id_level`)", |
|
1675 | - ), !$update_tables['planets']['ship_sattelite_sloth_porcent']); |
|
1667 | + upd_alter_table('planets', array( |
|
1668 | + "ADD `ship_sattelite_sloth_porcent` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' COMMENT 'Terran Sloth production'", |
|
1669 | + "ADD KEY `I_ship_sattelite_sloth` (`ship_sattelite_sloth`, `id_level`)", |
|
1670 | + "ADD KEY `I_ship_bomber_envy` (`ship_bomber_envy`, `id_level`)", |
|
1671 | + "ADD KEY `I_ship_recycler_gluttony` (`ship_recycler_gluttony`, `id_level`)", |
|
1672 | + "ADD KEY `I_ship_fighter_wrath` (`ship_fighter_wrath`, `id_level`)", |
|
1673 | + "ADD KEY `I_ship_battleship_pride` (`ship_battleship_pride`, `id_level`)", |
|
1674 | + "ADD KEY `I_ship_cargo_greed` (`ship_cargo_greed`, `id_level`)", |
|
1675 | + ), !$update_tables['planets']['ship_sattelite_sloth_porcent']); |
|
1676 | 1676 | |
1677 | - upd_check_key('stats_hide_admins', 1, !isset($config->stats_hide_admins)); |
|
1678 | - upd_check_key('stats_hide_player_list', '', !isset($config->stats_hide_player_list)); |
|
1677 | + upd_check_key('stats_hide_admins', 1, !isset($config->stats_hide_admins)); |
|
1678 | + upd_check_key('stats_hide_player_list', '', !isset($config->stats_hide_player_list)); |
|
1679 | 1679 | |
1680 | - upd_check_key('adv_seo_meta_description', '', !isset($config->adv_seo_meta_description)); |
|
1681 | - upd_check_key('adv_seo_meta_keywords', '', !isset($config->adv_seo_meta_keywords)); |
|
1680 | + upd_check_key('adv_seo_meta_description', '', !isset($config->adv_seo_meta_description)); |
|
1681 | + upd_check_key('adv_seo_meta_keywords', '', !isset($config->adv_seo_meta_keywords)); |
|
1682 | 1682 | |
1683 | - upd_check_key('stats_hide_pm_link', '0', !isset($config->stats_hide_pm_link)); |
|
1683 | + upd_check_key('stats_hide_pm_link', '0', !isset($config->stats_hide_pm_link)); |
|
1684 | 1684 | |
1685 | - upd_alter_table('notes', array( |
|
1686 | - "ADD INDEX `I_owner_priority_time` (`owner`, `priority`, `time`)", |
|
1687 | - ), !$update_indexes['notes']['I_owner_priority_time']); |
|
1685 | + upd_alter_table('notes', array( |
|
1686 | + "ADD INDEX `I_owner_priority_time` (`owner`, `priority`, `time`)", |
|
1687 | + ), !$update_indexes['notes']['I_owner_priority_time']); |
|
1688 | 1688 | |
1689 | - if(!$update_tables['buddy']['BUDDY_ID']) |
|
1690 | - { |
|
1691 | - upd_alter_table('buddy', array( |
|
1692 | - "CHANGE COLUMN `id` `BUDDY_ID` SERIAL COMMENT 'Buddy table row ID'", |
|
1693 | - "CHANGE COLUMN `active` `BUDDY_STATUS` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Buddy request status'", |
|
1694 | - "CHANGE COLUMN `text` `BUDDY_REQUEST` TINYTEXT DEFAULT '' COMMENT 'Buddy request text'", // 255 chars |
|
1695 | - |
|
1696 | - "DROP INDEX `id`", |
|
1697 | - |
|
1698 | - "DROP FOREIGN KEY `FK_buddy_sender_id`", |
|
1699 | - "DROP FOREIGN KEY `FK_buddy_owner_id`", |
|
1700 | - "DROP INDEX `I_buddy_sender`", |
|
1701 | - "DROP INDEX `I_buddy_owner`", |
|
1702 | - ), !$update_tables['buddy']['BUDDY_ID']); |
|
1703 | - |
|
1704 | - upd_alter_table('buddy', array( |
|
1705 | - "CHANGE COLUMN `sender` `BUDDY_SENDER_ID` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Buddy request sender ID'", |
|
1706 | - "CHANGE COLUMN `owner` `BUDDY_OWNER_ID` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Buddy request recipient ID'", |
|
1707 | - ), !$update_tables['buddy']['BUDDY_SENDER']); |
|
1708 | - |
|
1709 | - $query = upd_do_query("SELECT `BUDDY_ID`, `BUDDY_SENDER_ID`, `BUDDY_OWNER_ID` FROM {{buddy}} ORDER BY `BUDDY_ID`;"); |
|
1710 | - $found = $lost = array(); |
|
1711 | - while($row = db_fetch($query)) |
|
1689 | + if(!$update_tables['buddy']['BUDDY_ID']) |
|
1712 | 1690 | { |
1713 | - $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']) . ';' . max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']); |
|
1714 | - if(!isset($found[$index])) |
|
1691 | + upd_alter_table('buddy', array( |
|
1692 | + "CHANGE COLUMN `id` `BUDDY_ID` SERIAL COMMENT 'Buddy table row ID'", |
|
1693 | + "CHANGE COLUMN `active` `BUDDY_STATUS` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Buddy request status'", |
|
1694 | + "CHANGE COLUMN `text` `BUDDY_REQUEST` TINYTEXT DEFAULT '' COMMENT 'Buddy request text'", // 255 chars |
|
1695 | + |
|
1696 | + "DROP INDEX `id`", |
|
1697 | + |
|
1698 | + "DROP FOREIGN KEY `FK_buddy_sender_id`", |
|
1699 | + "DROP FOREIGN KEY `FK_buddy_owner_id`", |
|
1700 | + "DROP INDEX `I_buddy_sender`", |
|
1701 | + "DROP INDEX `I_buddy_owner`", |
|
1702 | + ), !$update_tables['buddy']['BUDDY_ID']); |
|
1703 | + |
|
1704 | + upd_alter_table('buddy', array( |
|
1705 | + "CHANGE COLUMN `sender` `BUDDY_SENDER_ID` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Buddy request sender ID'", |
|
1706 | + "CHANGE COLUMN `owner` `BUDDY_OWNER_ID` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Buddy request recipient ID'", |
|
1707 | + ), !$update_tables['buddy']['BUDDY_SENDER']); |
|
1708 | + |
|
1709 | + $query = upd_do_query("SELECT `BUDDY_ID`, `BUDDY_SENDER_ID`, `BUDDY_OWNER_ID` FROM {{buddy}} ORDER BY `BUDDY_ID`;"); |
|
1710 | + $found = $lost = array(); |
|
1711 | + while($row = db_fetch($query)) |
|
1715 | 1712 | { |
1716 | - $found[$index] = $row['BUDDY_ID']; |
|
1713 | + $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']) . ';' . max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']); |
|
1714 | + if(!isset($found[$index])) |
|
1715 | + { |
|
1716 | + $found[$index] = $row['BUDDY_ID']; |
|
1717 | + } |
|
1718 | + else |
|
1719 | + { |
|
1720 | + $lost[] = $row['BUDDY_ID']; |
|
1721 | + } |
|
1717 | 1722 | } |
1718 | - else |
|
1723 | + $lost = implode(',', $lost); |
|
1724 | + if($lost) |
|
1719 | 1725 | { |
1720 | - $lost[] = $row['BUDDY_ID']; |
|
1726 | + upd_do_query("DELETE FROM {{buddy}} WHERE `BUDDY_ID` IN ({$lost})"); |
|
1721 | 1727 | } |
1722 | - } |
|
1723 | - $lost = implode(',', $lost); |
|
1724 | - if($lost) |
|
1725 | - { |
|
1726 | - upd_do_query("DELETE FROM {{buddy}} WHERE `BUDDY_ID` IN ({$lost})"); |
|
1727 | - } |
|
1728 | 1728 | |
1729 | - upd_alter_table('buddy', array( |
|
1730 | - "ADD KEY `I_BUDDY_SENDER_ID` (`BUDDY_SENDER_ID`, `BUDDY_OWNER_ID`)", |
|
1731 | - "ADD KEY `I_BUDDY_OWNER_ID` (`BUDDY_OWNER_ID`, `BUDDY_SENDER_ID`)", |
|
1729 | + upd_alter_table('buddy', array( |
|
1730 | + "ADD KEY `I_BUDDY_SENDER_ID` (`BUDDY_SENDER_ID`, `BUDDY_OWNER_ID`)", |
|
1731 | + "ADD KEY `I_BUDDY_OWNER_ID` (`BUDDY_OWNER_ID`, `BUDDY_SENDER_ID`)", |
|
1732 | 1732 | |
1733 | - "ADD CONSTRAINT `FK_BUDDY_SENDER_ID` FOREIGN KEY (`BUDDY_SENDER_ID`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1734 | - "ADD CONSTRAINT `FK_BUDDY_OWNER_ID` FOREIGN KEY (`BUDDY_OWNER_ID`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1735 | - ), !$update_indexes['buddy']['I_BUDDY_SENDER_ID']); |
|
1736 | - } |
|
1733 | + "ADD CONSTRAINT `FK_BUDDY_SENDER_ID` FOREIGN KEY (`BUDDY_SENDER_ID`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1734 | + "ADD CONSTRAINT `FK_BUDDY_OWNER_ID` FOREIGN KEY (`BUDDY_OWNER_ID`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
1735 | + ), !$update_indexes['buddy']['I_BUDDY_SENDER_ID']); |
|
1736 | + } |
|
1737 | 1737 | |
1738 | - upd_do_query('COMMIT;', true); |
|
1739 | - $new_version = 35; |
|
1738 | + upd_do_query('COMMIT;', true); |
|
1739 | + $new_version = 35; |
|
1740 | 1740 | |
1741 | - case 35: |
|
1742 | - upd_log_version_update(); |
|
1741 | + case 35: |
|
1742 | + upd_log_version_update(); |
|
1743 | 1743 | |
1744 | - upd_do_query("UPDATE {{users}} SET `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` IS NULL"); |
|
1744 | + upd_do_query("UPDATE {{users}} SET `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` IS NULL"); |
|
1745 | 1745 | |
1746 | - if(!$update_tables['ube_report']) |
|
1747 | - { |
|
1748 | - upd_create_table('ube_report', |
|
1749 | - "( |
|
1746 | + if(!$update_tables['ube_report']) |
|
1747 | + { |
|
1748 | + upd_create_table('ube_report', |
|
1749 | + "( |
|
1750 | 1750 | `ube_report_id` SERIAL COMMENT 'Report ID', |
1751 | 1751 | |
1752 | 1752 | `ube_report_cypher` CHAR(32) NOT NULL DEFAULT '' COMMENT '16 char secret report ID', |
@@ -1782,13 +1782,13 @@ discard block |
||
1782 | 1782 | PRIMARY KEY (`ube_report_id`), |
1783 | 1783 | KEY `I_ube_report_cypher` (`ube_report_cypher`) |
1784 | 1784 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1785 | - ); |
|
1786 | - } |
|
1785 | + ); |
|
1786 | + } |
|
1787 | 1787 | |
1788 | - if(!$update_tables['ube_report_player']) |
|
1789 | - { |
|
1790 | - upd_create_table('ube_report_player', |
|
1791 | - "( |
|
1788 | + if(!$update_tables['ube_report_player']) |
|
1789 | + { |
|
1790 | + upd_create_table('ube_report_player', |
|
1791 | + "( |
|
1792 | 1792 | `ube_report_player_id` SERIAL COMMENT 'Record ID', |
1793 | 1793 | `ube_report_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Report ID', |
1794 | 1794 | `ube_report_player_player_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Player ID', |
@@ -1804,13 +1804,13 @@ discard block |
||
1804 | 1804 | KEY `I_ube_report_player_player_id` (`ube_report_player_player_id`), |
1805 | 1805 | CONSTRAINT `FK_ube_report_player_ube_report` FOREIGN KEY (`ube_report_id`) REFERENCES `{$config->db_prefix}ube_report` (`ube_report_id`) ON UPDATE CASCADE ON DELETE CASCADE |
1806 | 1806 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1807 | - ); |
|
1808 | - } |
|
1807 | + ); |
|
1808 | + } |
|
1809 | 1809 | |
1810 | - if(!$update_tables['ube_report_fleet']) |
|
1811 | - { |
|
1812 | - upd_create_table('ube_report_fleet', |
|
1813 | - "( |
|
1810 | + if(!$update_tables['ube_report_fleet']) |
|
1811 | + { |
|
1812 | + upd_create_table('ube_report_fleet', |
|
1813 | + "( |
|
1814 | 1814 | `ube_report_fleet_id` SERIAL COMMENT 'Record DB ID', |
1815 | 1815 | |
1816 | 1816 | `ube_report_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Report ID', |
@@ -1835,17 +1835,17 @@ discard block |
||
1835 | 1835 | PRIMARY KEY (`ube_report_fleet_id`), |
1836 | 1836 | CONSTRAINT `FK_ube_report_fleet_ube_report` FOREIGN KEY (`ube_report_id`) REFERENCES `{$config->db_prefix}ube_report` (`ube_report_id`) ON UPDATE CASCADE ON DELETE CASCADE |
1837 | 1837 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1838 | - ); |
|
1839 | - } |
|
1838 | + ); |
|
1839 | + } |
|
1840 | 1840 | |
1841 | - if(!$update_tables['ube_report_unit']) |
|
1842 | - { |
|
1843 | - // TODO: Сохранять так же имя корабля - на случай конструкторов - не, хуйня. Конструктор может давать имена разные на разных языках |
|
1844 | - // Может сохранять имена удаленных кораблей долго? |
|
1841 | + if(!$update_tables['ube_report_unit']) |
|
1842 | + { |
|
1843 | + // TODO: Сохранять так же имя корабля - на случай конструкторов - не, хуйня. Конструктор может давать имена разные на разных языках |
|
1844 | + // Может сохранять имена удаленных кораблей долго? |
|
1845 | 1845 | |
1846 | - // round SIGNED!!! -1 например - для ауткома |
|
1847 | - upd_create_table('ube_report_unit', |
|
1848 | - "( |
|
1846 | + // round SIGNED!!! -1 например - для ауткома |
|
1847 | + upd_create_table('ube_report_unit', |
|
1848 | + "( |
|
1849 | 1849 | `ube_report_unit_id` SERIAL COMMENT 'Record DB ID', |
1850 | 1850 | |
1851 | 1851 | `ube_report_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Report ID', |
@@ -1873,13 +1873,13 @@ discard block |
||
1873 | 1873 | KEY `I_ube_report_unit_order` (`ube_report_unit_sort_order`), |
1874 | 1874 | CONSTRAINT `FK_ube_report_unit_ube_report` FOREIGN KEY (`ube_report_id`) REFERENCES `{$config->db_prefix}ube_report` (`ube_report_id`) ON UPDATE CASCADE ON DELETE CASCADE |
1875 | 1875 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1876 | - ); |
|
1877 | - } |
|
1876 | + ); |
|
1877 | + } |
|
1878 | 1878 | |
1879 | - if(!$update_tables['ube_report_outcome_fleet']) |
|
1880 | - { |
|
1881 | - upd_create_table('ube_report_outcome_fleet', |
|
1882 | - "( |
|
1879 | + if(!$update_tables['ube_report_outcome_fleet']) |
|
1880 | + { |
|
1881 | + upd_create_table('ube_report_outcome_fleet', |
|
1882 | + "( |
|
1883 | 1883 | `ube_report_outcome_fleet_id` SERIAL COMMENT 'Record DB ID', |
1884 | 1884 | |
1885 | 1885 | `ube_report_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Report ID', |
@@ -1903,13 +1903,13 @@ discard block |
||
1903 | 1903 | KEY `I_ube_report_outcome_fleet_report_fleet` (`ube_report_id`, `ube_report_outcome_fleet_fleet_id`), |
1904 | 1904 | CONSTRAINT `FK_ube_report_outcome_fleet_ube_report` FOREIGN KEY (`ube_report_id`) REFERENCES `{$config->db_prefix}ube_report` (`ube_report_id`) ON UPDATE CASCADE ON DELETE CASCADE |
1905 | 1905 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1906 | - ); |
|
1907 | - } |
|
1906 | + ); |
|
1907 | + } |
|
1908 | 1908 | |
1909 | - if(!$update_tables['ube_report_outcome_unit']) |
|
1910 | - { |
|
1911 | - upd_create_table('ube_report_outcome_unit', |
|
1912 | - "( |
|
1909 | + if(!$update_tables['ube_report_outcome_unit']) |
|
1910 | + { |
|
1911 | + upd_create_table('ube_report_outcome_unit', |
|
1912 | + "( |
|
1913 | 1913 | `ube_report_outcome_unit_id` SERIAL COMMENT 'Record DB ID', |
1914 | 1914 | |
1915 | 1915 | `ube_report_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Report ID', |
@@ -1925,13 +1925,13 @@ discard block |
||
1925 | 1925 | KEY `I_ube_report_outcome_unit_report_order` (`ube_report_id`, `ube_report_outcome_unit_sort_order`), |
1926 | 1926 | CONSTRAINT `FK_ube_report_outcome_unit_ube_report` FOREIGN KEY (`ube_report_id`) REFERENCES `{$config->db_prefix}ube_report` (`ube_report_id`) ON UPDATE CASCADE ON DELETE CASCADE |
1927 | 1927 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1928 | - ); |
|
1929 | - } |
|
1928 | + ); |
|
1929 | + } |
|
1930 | 1930 | |
1931 | - if(!$update_tables['unit']) |
|
1932 | - { |
|
1933 | - upd_create_table('unit', |
|
1934 | - "( |
|
1931 | + if(!$update_tables['unit']) |
|
1932 | + { |
|
1933 | + upd_create_table('unit', |
|
1934 | + "( |
|
1935 | 1935 | `unit_id` SERIAL COMMENT 'Record ID', |
1936 | 1936 | |
1937 | 1937 | `unit_player_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Unit owner', |
@@ -1945,13 +1945,13 @@ discard block |
||
1945 | 1945 | KEY `I_unit_player_location_snid` (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_snid`), |
1946 | 1946 | CONSTRAINT `FK_unit_player_id` FOREIGN KEY (`unit_player_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON UPDATE CASCADE ON DELETE CASCADE |
1947 | 1947 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1948 | - ); |
|
1949 | - } |
|
1948 | + ); |
|
1949 | + } |
|
1950 | 1950 | |
1951 | - if(!$update_tables['captain']) |
|
1952 | - { |
|
1953 | - upd_create_table('captain', |
|
1954 | - "( |
|
1951 | + if(!$update_tables['captain']) |
|
1952 | + { |
|
1953 | + upd_create_table('captain', |
|
1954 | + "( |
|
1955 | 1955 | `captain_id` SERIAL COMMENT 'Record ID', |
1956 | 1956 | `captain_unit_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Link to `unit` record', |
1957 | 1957 | |
@@ -1966,36 +1966,36 @@ discard block |
||
1966 | 1966 | KEY `I_captain_unit_id` (`captain_unit_id`), |
1967 | 1967 | CONSTRAINT `FK_captain_unit_id` FOREIGN KEY (`captain_unit_id`) REFERENCES `{$config->db_prefix}unit` (`unit_id`) ON UPDATE CASCADE ON DELETE CASCADE |
1968 | 1968 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
1969 | - ); |
|
1970 | - } |
|
1969 | + ); |
|
1970 | + } |
|
1971 | 1971 | |
1972 | - if(!$update_tables['fleets']['fleet_start_planet_id']) |
|
1973 | - { |
|
1974 | - upd_alter_table('fleets', array( |
|
1975 | - "ADD `fleet_start_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet start planet ID' AFTER `fleet_start_time`", |
|
1976 | - "ADD `fleet_end_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet end planet ID' AFTER `fleet_end_stay`", |
|
1972 | + if(!$update_tables['fleets']['fleet_start_planet_id']) |
|
1973 | + { |
|
1974 | + upd_alter_table('fleets', array( |
|
1975 | + "ADD `fleet_start_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet start planet ID' AFTER `fleet_start_time`", |
|
1976 | + "ADD `fleet_end_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet end planet ID' AFTER `fleet_end_stay`", |
|
1977 | 1977 | |
1978 | - "ADD KEY `I_fleet_start_planet_id` (`fleet_start_planet_id`)", |
|
1979 | - "ADD KEY `I_fleet_end_planet_id` (`fleet_end_planet_id`)", |
|
1978 | + "ADD KEY `I_fleet_start_planet_id` (`fleet_start_planet_id`)", |
|
1979 | + "ADD KEY `I_fleet_end_planet_id` (`fleet_end_planet_id`)", |
|
1980 | 1980 | |
1981 | - "ADD CONSTRAINT `FK_fleet_planet_start` FOREIGN KEY (`fleet_start_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
1982 | - "ADD CONSTRAINT `FK_fleet_planet_end` FOREIGN KEY (`fleet_end_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
1983 | - ), !$update_tables['fleets']['fleet_start_planet_id']); |
|
1981 | + "ADD CONSTRAINT `FK_fleet_planet_start` FOREIGN KEY (`fleet_start_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
1982 | + "ADD CONSTRAINT `FK_fleet_planet_end` FOREIGN KEY (`fleet_end_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
1983 | + ), !$update_tables['fleets']['fleet_start_planet_id']); |
|
1984 | 1984 | |
1985 | - upd_do_query(" |
|
1985 | + upd_do_query(" |
|
1986 | 1986 | UPDATE {{fleets}} AS f |
1987 | 1987 | LEFT JOIN {{planets}} AS p_s ON p_s.galaxy = f.fleet_start_galaxy AND p_s.system = f.fleet_start_system AND p_s.planet = f.fleet_start_planet AND p_s.planet_type = f.fleet_start_type |
1988 | 1988 | LEFT JOIN {{planets}} AS p_e ON p_e.galaxy = f.fleet_end_galaxy AND p_e.system = f.fleet_end_system AND p_e.planet = f.fleet_end_planet AND p_e.planet_type = f.fleet_end_type |
1989 | 1989 | SET f.fleet_start_planet_id = p_s.id, f.fleet_end_planet_id = p_e.id |
1990 | 1990 | "); |
1991 | - } |
|
1991 | + } |
|
1992 | 1992 | |
1993 | - upd_alter_table('fleets', array("DROP COLUMN `processing_start`"), $update_tables['fleets']['processing_start']); |
|
1993 | + upd_alter_table('fleets', array("DROP COLUMN `processing_start`"), $update_tables['fleets']['processing_start']); |
|
1994 | 1994 | |
1995 | - if(!$update_tables['chat_player']) |
|
1996 | - { |
|
1997 | - upd_create_table('chat_player', |
|
1998 | - "( |
|
1995 | + if(!$update_tables['chat_player']) |
|
1996 | + { |
|
1997 | + upd_create_table('chat_player', |
|
1998 | + "( |
|
1999 | 1999 | `chat_player_id` SERIAL COMMENT 'Record ID', |
2000 | 2000 | |
2001 | 2001 | `chat_player_player_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Chat player record owner', |
@@ -2011,105 +2011,105 @@ discard block |
||
2011 | 2011 | CONSTRAINT `FK_chat_player_id` FOREIGN KEY (`chat_player_player_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON UPDATE CASCADE ON DELETE CASCADE |
2012 | 2012 | |
2013 | 2013 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
2014 | - ); |
|
2015 | - } |
|
2016 | - |
|
2017 | - upd_alter_table('chat', array( |
|
2018 | - "ADD `chat_message_sender_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Message sender ID' AFTER `messageid`", |
|
2019 | - "ADD `chat_message_recipient_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Message recipient ID' AFTER `user`", |
|
2014 | + ); |
|
2015 | + } |
|
2020 | 2016 | |
2021 | - "ADD KEY `I_chat_message_sender_id` (`chat_message_sender_id`)", |
|
2022 | - "ADD KEY `I_chat_message_recipient_id` (`chat_message_recipient_id`)", |
|
2017 | + upd_alter_table('chat', array( |
|
2018 | + "ADD `chat_message_sender_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Message sender ID' AFTER `messageid`", |
|
2019 | + "ADD `chat_message_recipient_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Message recipient ID' AFTER `user`", |
|
2023 | 2020 | |
2024 | - "ADD CONSTRAINT `FK_chat_message_sender_user_id` FOREIGN KEY (`chat_message_sender_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2025 | - "ADD CONSTRAINT `FK_chat_message_sender_recipient_id` FOREIGN KEY (`chat_message_recipient_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2026 | - ), !$update_tables['chat']['chat_message_sender_id']); |
|
2021 | + "ADD KEY `I_chat_message_sender_id` (`chat_message_sender_id`)", |
|
2022 | + "ADD KEY `I_chat_message_recipient_id` (`chat_message_recipient_id`)", |
|
2027 | 2023 | |
2028 | - upd_alter_table('chat', array( |
|
2029 | - "ADD `chat_message_sender_name` VARCHAR(64) DEFAULT '' COMMENT 'Message sender name' AFTER `chat_message_sender_id`", |
|
2030 | - "ADD `chat_message_recipient_name` VARCHAR(64) DEFAULT '' COMMENT 'Message sender name' AFTER `chat_message_recipient_id`", |
|
2031 | - ), !$update_tables['chat']['chat_message_sender_name']); |
|
2024 | + "ADD CONSTRAINT `FK_chat_message_sender_user_id` FOREIGN KEY (`chat_message_sender_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2025 | + "ADD CONSTRAINT `FK_chat_message_sender_recipient_id` FOREIGN KEY (`chat_message_recipient_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2026 | + ), !$update_tables['chat']['chat_message_sender_id']); |
|
2032 | 2027 | |
2033 | - upd_alter_table('users', array( |
|
2034 | - "MODIFY COLUMN `banaday` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'User ban status'", |
|
2035 | - ), strtoupper($update_tables['users']['banaday']['Null']) == 'YES'); |
|
2028 | + upd_alter_table('chat', array( |
|
2029 | + "ADD `chat_message_sender_name` VARCHAR(64) DEFAULT '' COMMENT 'Message sender name' AFTER `chat_message_sender_id`", |
|
2030 | + "ADD `chat_message_recipient_name` VARCHAR(64) DEFAULT '' COMMENT 'Message sender name' AFTER `chat_message_recipient_id`", |
|
2031 | + ), !$update_tables['chat']['chat_message_sender_name']); |
|
2036 | 2032 | |
2037 | - upd_alter_table('banned', array( |
|
2038 | - "ADD `ban_user_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Banned user ID' AFTER `ban_id`", |
|
2039 | - "ADD `ban_issuer_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Banner ID' AFTER `ban_until`", |
|
2033 | + upd_alter_table('users', array( |
|
2034 | + "MODIFY COLUMN `banaday` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'User ban status'", |
|
2035 | + ), strtoupper($update_tables['users']['banaday']['Null']) == 'YES'); |
|
2040 | 2036 | |
2041 | - "ADD KEY `I_ban_user_id` (`ban_user_id`)", |
|
2042 | - "ADD KEY `I_ban_issuer_id` (`ban_issuer_id`)", |
|
2037 | + upd_alter_table('banned', array( |
|
2038 | + "ADD `ban_user_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Banned user ID' AFTER `ban_id`", |
|
2039 | + "ADD `ban_issuer_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Banner ID' AFTER `ban_until`", |
|
2043 | 2040 | |
2044 | - "ADD CONSTRAINT `FK_ban_user_id` FOREIGN KEY (`ban_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
2045 | - "ADD CONSTRAINT `FK_ban_issuer_id` FOREIGN KEY (`ban_issuer_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
2046 | - ), !$update_tables['banned']['ban_user_id']); |
|
2041 | + "ADD KEY `I_ban_user_id` (`ban_user_id`)", |
|
2042 | + "ADD KEY `I_ban_issuer_id` (`ban_issuer_id`)", |
|
2047 | 2043 | |
2048 | - upd_do_query('COMMIT;', true); |
|
2049 | - $new_version = 36; |
|
2044 | + "ADD CONSTRAINT `FK_ban_user_id` FOREIGN KEY (`ban_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
2045 | + "ADD CONSTRAINT `FK_ban_issuer_id` FOREIGN KEY (`ban_issuer_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
2046 | + ), !$update_tables['banned']['ban_user_id']); |
|
2050 | 2047 | |
2051 | - case 36: |
|
2052 | - upd_log_version_update(); |
|
2048 | + upd_do_query('COMMIT;', true); |
|
2049 | + $new_version = 36; |
|
2053 | 2050 | |
2054 | - upd_alter_table('payment', array( |
|
2055 | - "DROP FOREIGN KEY `FK_payment_user`", |
|
2056 | - ), $update_foreigns['payment']['FK_payment_user']); |
|
2051 | + case 36: |
|
2052 | + upd_log_version_update(); |
|
2057 | 2053 | |
2058 | - if($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') |
|
2059 | - { |
|
2060 | - upd_alter_table('chat', array( |
|
2061 | - "DROP FOREIGN KEY `FK_chat_message_sender_user_id`", |
|
2062 | - "DROP FOREIGN KEY `FK_chat_message_sender_recipient_id`", |
|
2063 | - ), true); |
|
2054 | + upd_alter_table('payment', array( |
|
2055 | + "DROP FOREIGN KEY `FK_payment_user`", |
|
2056 | + ), $update_foreigns['payment']['FK_payment_user']); |
|
2064 | 2057 | |
2065 | - upd_alter_table('chat', array( |
|
2066 | - "ADD CONSTRAINT `FK_chat_message_sender_user_id` FOREIGN KEY (`chat_message_sender_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2067 | - "ADD CONSTRAINT `FK_chat_message_sender_recipient_id` FOREIGN KEY (`chat_message_recipient_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2068 | - ), true); |
|
2069 | - } |
|
2058 | + if($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') |
|
2059 | + { |
|
2060 | + upd_alter_table('chat', array( |
|
2061 | + "DROP FOREIGN KEY `FK_chat_message_sender_user_id`", |
|
2062 | + "DROP FOREIGN KEY `FK_chat_message_sender_recipient_id`", |
|
2063 | + ), true); |
|
2064 | + |
|
2065 | + upd_alter_table('chat', array( |
|
2066 | + "ADD CONSTRAINT `FK_chat_message_sender_user_id` FOREIGN KEY (`chat_message_sender_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2067 | + "ADD CONSTRAINT `FK_chat_message_sender_recipient_id` FOREIGN KEY (`chat_message_recipient_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2068 | + ), true); |
|
2069 | + } |
|
2070 | 2070 | |
2071 | - upd_alter_table('users', array( |
|
2072 | - "ADD `user_time_diff` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `onlinetime`", |
|
2073 | - "ADD `user_time_diff_forced` TINYINT(1) DEFAULT 0 COMMENT 'User time difference forced with time zone selection flag' AFTER `user_time_diff`", |
|
2074 | - ), !$update_tables['users']['user_time_diff']); |
|
2071 | + upd_alter_table('users', array( |
|
2072 | + "ADD `user_time_diff` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `onlinetime`", |
|
2073 | + "ADD `user_time_diff_forced` TINYINT(1) DEFAULT 0 COMMENT 'User time difference forced with time zone selection flag' AFTER `user_time_diff`", |
|
2074 | + ), !$update_tables['users']['user_time_diff']); |
|
2075 | 2075 | |
2076 | - upd_alter_table('planets', array( |
|
2077 | - "ADD `ship_orbital_heavy` bigint(20) NOT NULL DEFAULT '0' COMMENT 'HOPe - Heavy Orbital Platform'", |
|
2078 | - ), !$update_tables['planets']['ship_orbital_heavy']); |
|
2076 | + upd_alter_table('planets', array( |
|
2077 | + "ADD `ship_orbital_heavy` bigint(20) NOT NULL DEFAULT '0' COMMENT 'HOPe - Heavy Orbital Platform'", |
|
2078 | + ), !$update_tables['planets']['ship_orbital_heavy']); |
|
2079 | 2079 | |
2080 | - upd_check_key('chat_refresh_rate', 5, !isset($config->chat_refresh_rate)); |
|
2080 | + upd_check_key('chat_refresh_rate', 5, !isset($config->chat_refresh_rate)); |
|
2081 | 2081 | |
2082 | - upd_alter_table('chat_player', array( |
|
2083 | - "ADD `chat_player_refresh_last` INT(11) NOT NULL DEFAULT 0 COMMENT 'Player last refresh time'", |
|
2082 | + upd_alter_table('chat_player', array( |
|
2083 | + "ADD `chat_player_refresh_last` INT(11) NOT NULL DEFAULT 0 COMMENT 'Player last refresh time'", |
|
2084 | 2084 | |
2085 | - "ADD KEY `I_chat_player_refresh_last` (`chat_player_refresh_last`)", |
|
2086 | - ), !$update_tables['chat_player']['chat_player_refresh_last']); |
|
2085 | + "ADD KEY `I_chat_player_refresh_last` (`chat_player_refresh_last`)", |
|
2086 | + ), !$update_tables['chat_player']['chat_player_refresh_last']); |
|
2087 | 2087 | |
2088 | - upd_alter_table('ube_report', array( |
|
2089 | - "ADD KEY `I_ube_report_time_combat` (`ube_report_time_combat`)", |
|
2090 | - ), !$update_indexes['ube_report']['I_ube_report_time_combat']); |
|
2088 | + upd_alter_table('ube_report', array( |
|
2089 | + "ADD KEY `I_ube_report_time_combat` (`ube_report_time_combat`)", |
|
2090 | + ), !$update_indexes['ube_report']['I_ube_report_time_combat']); |
|
2091 | 2091 | |
2092 | - if(!$update_tables['unit']['unit_time_start']) |
|
2093 | - { |
|
2094 | - upd_alter_table('unit', array( |
|
2095 | - "ADD COLUMN `unit_time_start` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation start time'", |
|
2096 | - "ADD COLUMN `unit_time_finish` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation end time'", |
|
2097 | - ), !$update_tables['unit']['unit_time_start']); |
|
2092 | + if(!$update_tables['unit']['unit_time_start']) |
|
2093 | + { |
|
2094 | + upd_alter_table('unit', array( |
|
2095 | + "ADD COLUMN `unit_time_start` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation start time'", |
|
2096 | + "ADD COLUMN `unit_time_finish` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation end time'", |
|
2097 | + ), !$update_tables['unit']['unit_time_start']); |
|
2098 | 2098 | |
2099 | - upd_do_query( |
|
2100 | - "INSERT INTO {{unit}} |
|
2099 | + upd_do_query( |
|
2100 | + "INSERT INTO {{unit}} |
|
2101 | 2101 | (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level, unit_time_start, unit_time_finish) |
2102 | 2102 | SELECT |
2103 | 2103 | `powerup_user_id`, " . LOC_USER . ", `powerup_user_id`, `powerup_category`, `powerup_unit_id`, `powerup_unit_level` |
2104 | 2104 | , IF(`powerup_time_start`, FROM_UNIXTIME(`powerup_time_start`), NULL), IF(`powerup_time_finish`, FROM_UNIXTIME(`powerup_time_finish`), NULL) |
2105 | 2105 | FROM {{powerup}}" |
2106 | - ); |
|
2107 | - } |
|
2106 | + ); |
|
2107 | + } |
|
2108 | 2108 | |
2109 | - if(!$update_tables['que']) |
|
2110 | - { |
|
2111 | - upd_create_table('que', |
|
2112 | - "( |
|
2109 | + if(!$update_tables['que']) |
|
2110 | + { |
|
2111 | + upd_create_table('que', |
|
2112 | + "( |
|
2113 | 2113 | `que_id` SERIAL COMMENT 'Internal que id', |
2114 | 2114 | |
2115 | 2115 | `que_player_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Que owner ID', |
@@ -2135,175 +2135,175 @@ discard block |
||
2135 | 2135 | CONSTRAINT `FK_que_planet_id` FOREIGN KEY (`que_planet_id`) REFERENCES `{$config->db_prefix}planets` (`id`) ON UPDATE CASCADE ON DELETE CASCADE, |
2136 | 2136 | CONSTRAINT `FK_que_planet_id_origin` FOREIGN KEY (`que_planet_id_origin`) REFERENCES `{$config->db_prefix}planets` (`id`) ON UPDATE CASCADE ON DELETE CASCADE |
2137 | 2137 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
2138 | - ); |
|
2139 | - } |
|
2138 | + ); |
|
2139 | + } |
|
2140 | 2140 | |
2141 | - // Конвертирум очередь исследований |
|
2142 | - if($update_tables['users']['que']) |
|
2143 | - { |
|
2144 | - $que_lines = array(); |
|
2145 | - $que_query = upd_do_query("SELECT * FROM {{users}} WHERE `que`"); |
|
2146 | - while($que_row = db_fetch($que_query)) |
|
2141 | + // Конвертирум очередь исследований |
|
2142 | + if($update_tables['users']['que']) |
|
2147 | 2143 | { |
2148 | - $que_data = explode(',', $que_row['que']); |
|
2149 | - |
|
2150 | - if(!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) |
|
2144 | + $que_lines = array(); |
|
2145 | + $que_query = upd_do_query("SELECT * FROM {{users}} WHERE `que`"); |
|
2146 | + while($que_row = db_fetch($que_query)) |
|
2151 | 2147 | { |
2152 | - continue; |
|
2153 | - } |
|
2148 | + $que_data = explode(',', $que_row['que']); |
|
2154 | 2149 | |
2155 | - $que_data[QI_TIME] = $que_data[QI_TIME] >= 0 ? $que_data[QI_TIME] : 0; |
|
2156 | - // Если планета пустая - ставим главку |
|
2157 | - $que_data[QI_PLANET_ID] = $que_data[QI_PLANET_ID] ? $que_data[QI_PLANET_ID] : $que_row['id_planet']; |
|
2158 | - if($que_data[QI_PLANET_ID]) |
|
2159 | - { |
|
2160 | - $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
|
2161 | - if(!$que_planet_check['id']) |
|
2150 | + if(!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) |
|
2151 | + { |
|
2152 | + continue; |
|
2153 | + } |
|
2154 | + |
|
2155 | + $que_data[QI_TIME] = $que_data[QI_TIME] >= 0 ? $que_data[QI_TIME] : 0; |
|
2156 | + // Если планета пустая - ставим главку |
|
2157 | + $que_data[QI_PLANET_ID] = $que_data[QI_PLANET_ID] ? $que_data[QI_PLANET_ID] : $que_row['id_planet']; |
|
2158 | + if($que_data[QI_PLANET_ID]) |
|
2162 | 2159 | { |
2163 | - $que_data[QI_PLANET_ID] = $que_row['id_planet']; |
|
2164 | 2160 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
2165 | 2161 | if(!$que_planet_check['id']) |
2166 | 2162 | { |
2167 | - $que_data[QI_PLANET_ID] = 'NULL'; |
|
2163 | + $que_data[QI_PLANET_ID] = $que_row['id_planet']; |
|
2164 | + $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
|
2165 | + if(!$que_planet_check['id']) |
|
2166 | + { |
|
2167 | + $que_data[QI_PLANET_ID] = 'NULL'; |
|
2168 | + } |
|
2168 | 2169 | } |
2169 | 2170 | } |
2170 | - } |
|
2171 | - else |
|
2172 | - { |
|
2173 | - $que_data[QI_PLANET_ID] = 'NULL'; |
|
2174 | - } |
|
2171 | + else |
|
2172 | + { |
|
2173 | + $que_data[QI_PLANET_ID] = 'NULL'; |
|
2174 | + } |
|
2175 | 2175 | |
2176 | - $unit_info = get_unit_param($que_data[QI_UNIT_ID]); |
|
2177 | - $unit_level = $que_row[$unit_info[P_NAME]]; |
|
2178 | - $unit_factor = $unit_info[P_COST][P_FACTOR] ? $unit_info[P_COST][P_FACTOR] : 1; |
|
2179 | - $price_increase = pow($unit_factor, $unit_level); |
|
2180 | - $unit_level++; |
|
2181 | - $unit_cost = array(); |
|
2182 | - foreach($unit_info[P_COST] as $resource_id => $resource_amount) |
|
2183 | - { |
|
2184 | - if($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) |
|
2176 | + $unit_info = get_unit_param($que_data[QI_UNIT_ID]); |
|
2177 | + $unit_level = $que_row[$unit_info[P_NAME]]; |
|
2178 | + $unit_factor = $unit_info[P_COST][P_FACTOR] ? $unit_info[P_COST][P_FACTOR] : 1; |
|
2179 | + $price_increase = pow($unit_factor, $unit_level); |
|
2180 | + $unit_level++; |
|
2181 | + $unit_cost = array(); |
|
2182 | + foreach($unit_info[P_COST] as $resource_id => $resource_amount) |
|
2185 | 2183 | { |
2186 | - continue; |
|
2184 | + if($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) |
|
2185 | + { |
|
2186 | + continue; |
|
2187 | + } |
|
2188 | + $unit_cost[] = $resource_id . ',' . floor($resource_cost); |
|
2187 | 2189 | } |
2188 | - $unit_cost[] = $resource_id . ',' . floor($resource_cost); |
|
2190 | + $unit_cost = implode(';', $unit_cost); |
|
2191 | + |
|
2192 | + $que_lines[] = "({$que_row['id']},{$que_data[QI_PLANET_ID]}," . QUE_RESEARCH . ",{$que_data[QI_TIME]},{$que_data[QI_UNIT_ID]},1," . |
|
2193 | + BUILD_CREATE . ",{$unit_level},{$que_data[QI_TIME]},'{$unit_cost}')"; |
|
2189 | 2194 | } |
2190 | - $unit_cost = implode(';', $unit_cost); |
|
2191 | 2195 | |
2192 | - $que_lines[] = "({$que_row['id']},{$que_data[QI_PLANET_ID]}," . QUE_RESEARCH . ",{$que_data[QI_TIME]},{$que_data[QI_UNIT_ID]},1," . |
|
2193 | - BUILD_CREATE . ",{$unit_level},{$que_data[QI_TIME]},'{$unit_cost}')"; |
|
2194 | - } |
|
2196 | + if(!empty($que_lines)) |
|
2197 | + { |
|
2198 | + upd_do_query('INSERT INTO `{{que}}` (`que_player_id`,`que_planet_id_origin`,`que_type`,`que_time_left`,`que_unit_id`,`que_unit_amount`,`que_unit_mode`,`que_unit_level`,`que_unit_time`,`que_unit_price`) VALUES ' . implode(',', $que_lines)); |
|
2199 | + } |
|
2195 | 2200 | |
2196 | - if(!empty($que_lines)) |
|
2197 | - { |
|
2198 | - upd_do_query('INSERT INTO `{{que}}` (`que_player_id`,`que_planet_id_origin`,`que_type`,`que_time_left`,`que_unit_id`,`que_unit_amount`,`que_unit_mode`,`que_unit_level`,`que_unit_time`,`que_unit_price`) VALUES ' . implode(',', $que_lines)); |
|
2201 | + upd_alter_table('users', array( |
|
2202 | + "DROP COLUMN `que`", |
|
2203 | + ), $update_tables['users']['que']); |
|
2199 | 2204 | } |
2200 | 2205 | |
2201 | - upd_alter_table('users', array( |
|
2202 | - "DROP COLUMN `que`", |
|
2203 | - ), $update_tables['users']['que']); |
|
2204 | - } |
|
2205 | - |
|
2206 | - |
|
2207 | - upd_check_key('server_que_length_research', 1, !isset($config->server_que_length_research)); |
|
2208 | 2206 | |
2207 | + upd_check_key('server_que_length_research', 1, !isset($config->server_que_length_research)); |
|
2209 | 2208 | |
2210 | - // Ковертируем технологии в таблицы |
|
2211 | - if($update_tables['users']['graviton_tech']) |
|
2212 | - { |
|
2213 | - upd_do_query("DELETE FROM {{unit}} WHERE unit_type = " . UNIT_TECHNOLOGIES); |
|
2214 | 2209 | |
2215 | - $que_lines = array(); |
|
2216 | - $user_query = upd_do_query("SELECT * FROM {{users}}"); |
|
2217 | - upd_add_more_time(300); |
|
2218 | - $sn_group_tech = sn_get_groups('tech'); |
|
2219 | - while($user_row = db_fetch($user_query)) |
|
2210 | + // Ковертируем технологии в таблицы |
|
2211 | + if($update_tables['users']['graviton_tech']) |
|
2220 | 2212 | { |
2221 | - foreach($sn_group_tech as $tech_id) |
|
2213 | + upd_do_query("DELETE FROM {{unit}} WHERE unit_type = " . UNIT_TECHNOLOGIES); |
|
2214 | + |
|
2215 | + $que_lines = array(); |
|
2216 | + $user_query = upd_do_query("SELECT * FROM {{users}}"); |
|
2217 | + upd_add_more_time(300); |
|
2218 | + $sn_group_tech = sn_get_groups('tech'); |
|
2219 | + while($user_row = db_fetch($user_query)) |
|
2222 | 2220 | { |
2223 | - if($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) |
|
2221 | + foreach($sn_group_tech as $tech_id) |
|
2224 | 2222 | { |
2225 | - $que_lines[] = "({$user_row['id']}," . LOC_USER . ",{$user_row['id']}," . UNIT_TECHNOLOGIES . ",{$tech_id},{$tech_level})"; |
|
2223 | + if($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) |
|
2224 | + { |
|
2225 | + $que_lines[] = "({$user_row['id']}," . LOC_USER . ",{$user_row['id']}," . UNIT_TECHNOLOGIES . ",{$tech_id},{$tech_level})"; |
|
2226 | + } |
|
2226 | 2227 | } |
2227 | 2228 | } |
2228 | - } |
|
2229 | - |
|
2230 | - if(!empty($que_lines)) |
|
2231 | - { |
|
2232 | - upd_do_query("INSERT INTO {{unit}} (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level) VALUES " . implode(',', $que_lines)); |
|
2233 | - } |
|
2234 | - |
|
2235 | - upd_alter_table('users', array( |
|
2236 | - "DROP COLUMN `graviton_tech`", |
|
2237 | - ), $update_tables['users']['graviton_tech']); |
|
2238 | - } |
|
2239 | 2229 | |
2240 | - if(!$update_indexes['unit']['I_unit_record_search']) |
|
2241 | - { |
|
2242 | - upd_alter_table('unit', array( |
|
2243 | - "ADD KEY `I_unit_record_search` (`unit_snid`,`unit_player_id`,`unit_level` DESC,`unit_id`)", |
|
2244 | - ), !$update_indexes['unit']['I_unit_record_search']); |
|
2230 | + if(!empty($que_lines)) |
|
2231 | + { |
|
2232 | + upd_do_query("INSERT INTO {{unit}} (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level) VALUES " . implode(',', $que_lines)); |
|
2233 | + } |
|
2245 | 2234 | |
2246 | - foreach(sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) |
|
2247 | - { |
|
2248 | - $planet_units[get_unit_param($unit_id, P_NAME)] = 1; |
|
2235 | + upd_alter_table('users', array( |
|
2236 | + "DROP COLUMN `graviton_tech`", |
|
2237 | + ), $update_tables['users']['graviton_tech']); |
|
2249 | 2238 | } |
2250 | - $drop_index = array(); |
|
2251 | - $create_index = &$drop_index; // array(); |
|
2252 | - foreach($planet_units as $unit_name => $unit_create) |
|
2239 | + |
|
2240 | + if(!$update_indexes['unit']['I_unit_record_search']) |
|
2253 | 2241 | { |
2254 | - if($update_indexes['planets']['I_' . $unit_name]) |
|
2242 | + upd_alter_table('unit', array( |
|
2243 | + "ADD KEY `I_unit_record_search` (`unit_snid`,`unit_player_id`,`unit_level` DESC,`unit_id`)", |
|
2244 | + ), !$update_indexes['unit']['I_unit_record_search']); |
|
2245 | + |
|
2246 | + foreach(sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) |
|
2255 | 2247 | { |
2256 | - $drop_index[] = "DROP KEY I_{$unit_name}"; |
|
2248 | + $planet_units[get_unit_param($unit_id, P_NAME)] = 1; |
|
2257 | 2249 | } |
2258 | - if($update_indexes['planets']['i_' . $unit_name]) |
|
2250 | + $drop_index = array(); |
|
2251 | + $create_index = &$drop_index; // array(); |
|
2252 | + foreach($planet_units as $unit_name => $unit_create) |
|
2259 | 2253 | { |
2260 | - $drop_index[] = "DROP KEY i_{$unit_name}"; |
|
2261 | - } |
|
2254 | + if($update_indexes['planets']['I_' . $unit_name]) |
|
2255 | + { |
|
2256 | + $drop_index[] = "DROP KEY I_{$unit_name}"; |
|
2257 | + } |
|
2258 | + if($update_indexes['planets']['i_' . $unit_name]) |
|
2259 | + { |
|
2260 | + $drop_index[] = "DROP KEY i_{$unit_name}"; |
|
2261 | + } |
|
2262 | 2262 | |
2263 | - if($unit_create) |
|
2264 | - { |
|
2265 | - $create_index[] = "ADD KEY `I_{$unit_name}` (`id_owner`, {$unit_name} DESC)"; |
|
2263 | + if($unit_create) |
|
2264 | + { |
|
2265 | + $create_index[] = "ADD KEY `I_{$unit_name}` (`id_owner`, {$unit_name} DESC)"; |
|
2266 | + } |
|
2266 | 2267 | } |
2268 | + upd_alter_table('planets', $drop_index, true); |
|
2267 | 2269 | } |
2268 | - upd_alter_table('planets', $drop_index, true); |
|
2269 | - } |
|
2270 | 2270 | |
2271 | - upd_alter_table('users', array( |
|
2272 | - "ADD `user_time_utc_offset` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `user_time_diff`", |
|
2273 | - ), !$update_tables['users']['user_time_utc_offset']); |
|
2271 | + upd_alter_table('users', array( |
|
2272 | + "ADD `user_time_utc_offset` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `user_time_diff`", |
|
2273 | + ), !$update_tables['users']['user_time_utc_offset']); |
|
2274 | 2274 | |
2275 | - if(!$update_foreigns['alliance']['FK_alliance_owner']) |
|
2276 | - { |
|
2277 | - upd_do_query("UPDATE {{alliance}} SET ally_owner = null WHERE ally_owner not in (select id from {{users}})"); |
|
2275 | + if(!$update_foreigns['alliance']['FK_alliance_owner']) |
|
2276 | + { |
|
2277 | + upd_do_query("UPDATE {{alliance}} SET ally_owner = null WHERE ally_owner not in (select id from {{users}})"); |
|
2278 | 2278 | |
2279 | - upd_alter_table('alliance', array( |
|
2280 | - "ADD CONSTRAINT `FK_alliance_owner` FOREIGN KEY (`ally_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
2281 | - ), !$update_foreigns['alliance']['FK_alliance_owner']); |
|
2279 | + upd_alter_table('alliance', array( |
|
2280 | + "ADD CONSTRAINT `FK_alliance_owner` FOREIGN KEY (`ally_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", |
|
2281 | + ), !$update_foreigns['alliance']['FK_alliance_owner']); |
|
2282 | 2282 | |
2283 | - upd_do_query("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_ally_id not in (select id from {{alliance}}) OR alliance_negotiation_contr_ally_id not in (select id from {{alliance}})"); |
|
2283 | + upd_do_query("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_ally_id not in (select id from {{alliance}}) OR alliance_negotiation_contr_ally_id not in (select id from {{alliance}})"); |
|
2284 | 2284 | |
2285 | - upd_do_query("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_ally_id = alliance_negotiation_contr_ally_id"); |
|
2286 | - upd_do_query("DELETE FROM {{alliance_diplomacy}} WHERE alliance_diplomacy_ally_id = alliance_diplomacy_contr_ally_id"); |
|
2287 | - } |
|
2285 | + upd_do_query("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_ally_id = alliance_negotiation_contr_ally_id"); |
|
2286 | + upd_do_query("DELETE FROM {{alliance_diplomacy}} WHERE alliance_diplomacy_ally_id = alliance_diplomacy_contr_ally_id"); |
|
2287 | + } |
|
2288 | 2288 | |
2289 | - upd_alter_table('fleets', array( |
|
2290 | - 'MODIFY COLUMN `fleet_owner` BIGINT(20) UNSIGNED DEFAULT NULL', |
|
2291 | - "ADD CONSTRAINT `FK_fleet_owner` FOREIGN KEY (`fleet_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2292 | - ), strtoupper($update_tables['fleets']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
2289 | + upd_alter_table('fleets', array( |
|
2290 | + 'MODIFY COLUMN `fleet_owner` BIGINT(20) UNSIGNED DEFAULT NULL', |
|
2291 | + "ADD CONSTRAINT `FK_fleet_owner` FOREIGN KEY (`fleet_owner`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE", |
|
2292 | + ), strtoupper($update_tables['fleets']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
|
2293 | 2293 | |
2294 | - upd_check_key('chat_highlight_developer', '<span class="nick_developer">$1</span>', !$config->chat_highlight_developer); |
|
2294 | + upd_check_key('chat_highlight_developer', '<span class="nick_developer">$1</span>', !$config->chat_highlight_developer); |
|
2295 | 2295 | |
2296 | - if(!$update_tables['player_name_history']) |
|
2297 | - { |
|
2298 | - upd_check_key('game_user_changename_cost', 100000, !$config->game_user_changename_cost); |
|
2299 | - upd_check_key('game_user_changename', SERVER_PLAYER_NAME_CHANGE_PAY, $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_PAY); |
|
2296 | + if(!$update_tables['player_name_history']) |
|
2297 | + { |
|
2298 | + upd_check_key('game_user_changename_cost', 100000, !$config->game_user_changename_cost); |
|
2299 | + upd_check_key('game_user_changename', SERVER_PLAYER_NAME_CHANGE_PAY, $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_PAY); |
|
2300 | 2300 | |
2301 | - upd_alter_table('users', array( |
|
2302 | - "CHANGE COLUMN `username` `username` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'Player name'", |
|
2303 | - )); |
|
2301 | + upd_alter_table('users', array( |
|
2302 | + "CHANGE COLUMN `username` `username` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'Player name'", |
|
2303 | + )); |
|
2304 | 2304 | |
2305 | - upd_create_table('player_name_history', |
|
2306 | - "( |
|
2305 | + upd_create_table('player_name_history', |
|
2306 | + "( |
|
2307 | 2307 | `player_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Player ID', |
2308 | 2308 | `player_name` VARCHAR(32) NOT NULL COMMENT 'Historical player name', |
2309 | 2309 | `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When player changed name', |
@@ -2313,79 +2313,79 @@ discard block |
||
2313 | 2313 | |
2314 | 2314 | CONSTRAINT `FK_player_name_history_id` FOREIGN KEY (`player_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON UPDATE CASCADE ON DELETE CASCADE |
2315 | 2315 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
2316 | - ); |
|
2316 | + ); |
|
2317 | 2317 | |
2318 | - upd_do_query("REPLACE INTO {{player_name_history}} (`player_id`, `player_name`) SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NULL;"); |
|
2319 | - } |
|
2318 | + upd_do_query("REPLACE INTO {{player_name_history}} (`player_id`, `player_name`) SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NULL;"); |
|
2319 | + } |
|
2320 | 2320 | |
2321 | - upd_alter_table('planets', array( |
|
2322 | - "ADD `density` SMALLINT NOT NULL DEFAULT 5500 COMMENT 'Planet average density kg/m3'", |
|
2323 | - "ADD `density_index` TINYINT NOT NULL DEFAULT " . PLANET_DENSITY_STANDARD . " COMMENT 'Planet cached density index'", |
|
2324 | - ), !$update_tables['planets']['density_index']); |
|
2321 | + upd_alter_table('planets', array( |
|
2322 | + "ADD `density` SMALLINT NOT NULL DEFAULT 5500 COMMENT 'Planet average density kg/m3'", |
|
2323 | + "ADD `density_index` TINYINT NOT NULL DEFAULT " . PLANET_DENSITY_STANDARD . " COMMENT 'Planet cached density index'", |
|
2324 | + ), !$update_tables['planets']['density_index']); |
|
2325 | 2325 | |
2326 | - if($update_tables['users']['player_artifact_list']) |
|
2327 | - { |
|
2328 | - upd_alter_table('unit', "DROP KEY `unit_id`", $update_indexes['unit']['unit_id']); |
|
2326 | + if($update_tables['users']['player_artifact_list']) |
|
2327 | + { |
|
2328 | + upd_alter_table('unit', "DROP KEY `unit_id`", $update_indexes['unit']['unit_id']); |
|
2329 | 2329 | |
2330 | - upd_alter_table('unit', "ADD KEY `I_unit_player_location_snid` (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_snid`)", !$update_indexes['unit']['I_unit_player_location_snid']); |
|
2331 | - upd_alter_table('unit', "DROP KEY `I_unit_player_id_temporary`", $update_indexes['unit']['I_unit_player_id_temporary']); |
|
2330 | + upd_alter_table('unit', "ADD KEY `I_unit_player_location_snid` (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_snid`)", !$update_indexes['unit']['I_unit_player_location_snid']); |
|
2331 | + upd_alter_table('unit', "DROP KEY `I_unit_player_id_temporary`", $update_indexes['unit']['I_unit_player_id_temporary']); |
|
2332 | 2332 | |
2333 | - $sn_data_artifacts = sn_get_groups('artifacts'); |
|
2334 | - $db_changeset = array(); |
|
2333 | + $sn_data_artifacts = sn_get_groups('artifacts'); |
|
2334 | + $db_changeset = array(); |
|
2335 | 2335 | |
2336 | - $query = upd_do_query("SELECT `id`, `player_artifact_list` FROM {{users}} WHERE `player_artifact_list` IS NOT NULL AND `player_artifact_list` != '' FOR UPDATE"); |
|
2337 | - while($row = db_fetch($query)) |
|
2338 | - { |
|
2339 | - $artifact_list = explode(';', $row['player_artifact_list']); |
|
2340 | - if(!$row['player_artifact_list'] || empty($artifact_list)) |
|
2341 | - { |
|
2342 | - continue; |
|
2343 | - } |
|
2344 | - foreach($artifact_list as $key => &$value) |
|
2336 | + $query = upd_do_query("SELECT `id`, `player_artifact_list` FROM {{users}} WHERE `player_artifact_list` IS NOT NULL AND `player_artifact_list` != '' FOR UPDATE"); |
|
2337 | + while($row = db_fetch($query)) |
|
2345 | 2338 | { |
2346 | - $value = explode(',', $value); |
|
2347 | - if(!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) |
|
2339 | + $artifact_list = explode(';', $row['player_artifact_list']); |
|
2340 | + if(!$row['player_artifact_list'] || empty($artifact_list)) |
|
2348 | 2341 | { |
2349 | - unset($artifact_list[$key]); |
|
2350 | 2342 | continue; |
2351 | 2343 | } |
2352 | - $db_changeset['unit'][] = upd_db_unit_changeset_prepare($value[0], $value[1], $row); |
|
2344 | + foreach($artifact_list as $key => &$value) |
|
2345 | + { |
|
2346 | + $value = explode(',', $value); |
|
2347 | + if(!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) |
|
2348 | + { |
|
2349 | + unset($artifact_list[$key]); |
|
2350 | + continue; |
|
2351 | + } |
|
2352 | + $db_changeset['unit'][] = upd_db_unit_changeset_prepare($value[0], $value[1], $row); |
|
2353 | + } |
|
2353 | 2354 | } |
2354 | - } |
|
2355 | - upd_db_changeset_apply($db_changeset); |
|
2355 | + upd_db_changeset_apply($db_changeset); |
|
2356 | 2356 | |
2357 | - upd_alter_table('users', "DROP COLUMN `player_artifact_list`", $update_tables['users']['player_artifact_list']); |
|
2358 | - } |
|
2357 | + upd_alter_table('users', "DROP COLUMN `player_artifact_list`", $update_tables['users']['player_artifact_list']); |
|
2358 | + } |
|
2359 | 2359 | |
2360 | - upd_alter_table('users', array( |
|
2361 | - "DROP COLUMN `spy_tech`", |
|
2362 | - "DROP COLUMN `computer_tech`", |
|
2363 | - "DROP COLUMN `military_tech`", |
|
2364 | - "DROP COLUMN `defence_tech`", |
|
2365 | - "DROP COLUMN `shield_tech`", |
|
2366 | - "DROP COLUMN `energy_tech`", |
|
2367 | - "DROP COLUMN `hyperspace_tech`", |
|
2368 | - "DROP COLUMN `combustion_tech`", |
|
2369 | - "DROP COLUMN `impulse_motor_tech`", |
|
2370 | - "DROP COLUMN `hyperspace_motor_tech`", |
|
2371 | - "DROP COLUMN `laser_tech`", |
|
2372 | - "DROP COLUMN `ionic_tech`", |
|
2373 | - "DROP COLUMN `buster_tech`", |
|
2374 | - "DROP COLUMN `intergalactic_tech`", |
|
2375 | - "DROP COLUMN `expedition_tech`", |
|
2376 | - "DROP COLUMN `colonisation_tech`", |
|
2377 | - ), $update_tables['users']['spy_tech']); |
|
2378 | - |
|
2379 | - upd_check_key('payment_currency_exchange_dm_', 2500, !$config->payment_currency_exchange_dm_ || $config->payment_currency_exchange_dm_ == 1000); |
|
2380 | - upd_check_key('payment_currency_exchange_eur', 0.09259259259259, !$config->payment_currency_exchange_eur); |
|
2381 | - upd_check_key('payment_currency_exchange_rub', 4.0, !$config->payment_currency_exchange_rub); |
|
2382 | - upd_check_key('payment_currency_exchange_usd', 0.125, !$config->payment_currency_exchange_usd); |
|
2383 | - upd_check_key('payment_currency_exchange_wme', 0.0952380952381, !$config->payment_currency_exchange_usd); |
|
2384 | - upd_check_key('payment_currency_exchange_wmr', 4.1, !$config->payment_currency_exchange_wmr); |
|
2385 | - upd_check_key('payment_currency_exchange_wmu', 1.05, !$config->payment_currency_exchange_wmu); |
|
2386 | - upd_check_key('payment_currency_exchange_wmz', 0.126582278481, !$config->payment_currency_exchange_wmz); |
|
2360 | + upd_alter_table('users', array( |
|
2361 | + "DROP COLUMN `spy_tech`", |
|
2362 | + "DROP COLUMN `computer_tech`", |
|
2363 | + "DROP COLUMN `military_tech`", |
|
2364 | + "DROP COLUMN `defence_tech`", |
|
2365 | + "DROP COLUMN `shield_tech`", |
|
2366 | + "DROP COLUMN `energy_tech`", |
|
2367 | + "DROP COLUMN `hyperspace_tech`", |
|
2368 | + "DROP COLUMN `combustion_tech`", |
|
2369 | + "DROP COLUMN `impulse_motor_tech`", |
|
2370 | + "DROP COLUMN `hyperspace_motor_tech`", |
|
2371 | + "DROP COLUMN `laser_tech`", |
|
2372 | + "DROP COLUMN `ionic_tech`", |
|
2373 | + "DROP COLUMN `buster_tech`", |
|
2374 | + "DROP COLUMN `intergalactic_tech`", |
|
2375 | + "DROP COLUMN `expedition_tech`", |
|
2376 | + "DROP COLUMN `colonisation_tech`", |
|
2377 | + ), $update_tables['users']['spy_tech']); |
|
2378 | + |
|
2379 | + upd_check_key('payment_currency_exchange_dm_', 2500, !$config->payment_currency_exchange_dm_ || $config->payment_currency_exchange_dm_ == 1000); |
|
2380 | + upd_check_key('payment_currency_exchange_eur', 0.09259259259259, !$config->payment_currency_exchange_eur); |
|
2381 | + upd_check_key('payment_currency_exchange_rub', 4.0, !$config->payment_currency_exchange_rub); |
|
2382 | + upd_check_key('payment_currency_exchange_usd', 0.125, !$config->payment_currency_exchange_usd); |
|
2383 | + upd_check_key('payment_currency_exchange_wme', 0.0952380952381, !$config->payment_currency_exchange_usd); |
|
2384 | + upd_check_key('payment_currency_exchange_wmr', 4.1, !$config->payment_currency_exchange_wmr); |
|
2385 | + upd_check_key('payment_currency_exchange_wmu', 1.05, !$config->payment_currency_exchange_wmu); |
|
2386 | + upd_check_key('payment_currency_exchange_wmz', 0.126582278481, !$config->payment_currency_exchange_wmz); |
|
2387 | 2387 | |
2388 | - upd_do_query('COMMIT;', true); |
|
2389 | - $new_version = 37; |
|
2388 | + upd_do_query('COMMIT;', true); |
|
2389 | + $new_version = 37; |
|
2390 | 2390 | |
2391 | 2391 | } |