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