upd_do_query('UPDATE {{planets}} SET `temp_min` = `temp_max`'); // Оригинальные значения для статистики upd_do_query('UPDATE {{planets}} SET `position_original` = `planet`, `field_max_original` = `field_max`, `temp_min_original` = `temp_min`, `temp_max_original` = `temp_max`;'); // Миграция тяжмета в оливин upd_do_query('UPDATE {{planets}} SET `density_index` = ' . PLANET_DENSITY_METAL_PERIDOT . ' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); // Добавляем планету-странника upd_check_key('game_maxPlanet', 16, $config->game_maxPlanet == 15); } // 2015-08-19 04:41:57 40a8.10 upd_do_query('UPDATE {{planets}} SET `image` = "normaltempplanet01" WHERE `image` = "planet" OR `image` = "normaltemp01"'); // 2015-08-27 19:14:05 40a10.0 // Старая версия таблицы if (!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { upd_drop_table('account'); upd_drop_table('account_translate'); } if (empty($update_tables['account'])) { upd_create_table('account', " (\n `account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '',\n `account_password` char(32) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',\n `account_salt` char(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',\n `account_email` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT '',\n `account_email_verified` tinyint(1) unsigned NOT NULL DEFAULT 0,\n `account_register_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n `account_language` varchar(5) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'ru',\n `account_metamatter` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Metamatter amount',\n `account_metamatter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Metamatter amount ever bought',\n `account_immortal` TIMESTAMP NULL,\n PRIMARY KEY (`account_id`),\n UNIQUE KEY `I_account_name` (`account_name`),\n KEY `I_account_email` (`account_email`) -- Для поиска дубликатов по емейлу\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); upd_create_table('account_translate', " (\n `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider',\n `provider_account_id` bigint(20) unsigned NOT NULL COMMENT 'Account ID on provider',\n `user_id` bigint(20) unsigned NOT NULL COMMENT 'User ID',\n `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n PRIMARY KEY (`provider_id`, `provider_account_id`, `user_id`),\n KEY (`user_id`),\n CONSTRAINT `FK_account_translate_user_id` FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON UPDATE CASCADE ON DELETE CASCADE\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); upd_do_query("INSERT IGNORE INTO {{account}}\n (`account_id`, `account_name`, `account_password`, `account_salt`, `account_email`, `account_register_time`, `account_language`, `account_metamatter`, `account_metamatter_total`, `account_immortal`)\n SELECT\n `id`, `username`, `password`, `salt`, `email_2`, FROM_UNIXTIME(register_time), `lang`, `metamatter`, `metamatter_total`, `immortal`\n FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . ";"); upd_do_query("REPLACE INTO {{account_translate}} (`provider_id`, `provider_account_id`, `user_id`, `timestamp`)\n SELECT " . ACCOUNT_PROVIDER_LOCAL . ", a.account_id, u.id, a.`account_register_time`\n FROM {{users}} AS u\n JOIN {{account}} AS a ON\n a.account_name = u.username\n AND a.account_password = u.password\n AND a.account_salt = u.salt;"); } // 2015-08-31 12:34:21 40a10.8 upd_do_query('UPDATE {{planets}} SET `diameter` = SQRT(`field_max`) * 1000 WHERE `diameter` > 1000000'); // 2015-09-05 17:07:15 40a10.17 upd_alter_table('ube_report', "ADD COLUMN `ube_report_capture_result` tinyint unsigned NOT NULL DEFAULT " . UBE_CAPTURE_DISABLED, empty($update_tables['ube_report']['ube_report_capture_result'])); // 2015-09-07 21:11:48 40a10.19 upd_alter_table('security_url', "MODIFY COLUMN `url_string` VARCHAR(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''", empty($update_tables['security_url']['ube_report_capture_result'])); // 2015-09-24 11:39:37 40a10.25 if (empty($update_tables['log_metamatter']['provider_id'])) {
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;'); upd_do_query("UPDATE `{{logs}}` SET `log_code` = 190 WHERE `log_code` = 100 AND `log_title` = 'Stat update';"); upd_do_query("UPDATE `{{logs}}` SET `log_code` = 191 WHERE `log_code` = 101 AND `log_title` = 'Stat update';"); upd_do_query("UPDATE `{{logs}}` SET `log_code` = 192 WHERE `log_code` = 102 AND `log_title` = 'Stat update';"); $sys_log_disabled = false; upd_do_query('COMMIT;', true); $new_version = 26; case 26: upd_log_version_update(); $sys_log_disabled = false; upd_alter_table('planets', "ADD INDEX `i_parent_planet` (`parent_planet`)", !$update_indexes['planets']['i_parent_planet']); upd_alter_table('messages', "DROP INDEX `owner`", $update_indexes['messages']['owner']); upd_alter_table('messages', "DROP INDEX `owner_type`", $update_indexes['messages']['owner_type']); upd_alter_table('messages', "DROP INDEX `sender_type`", $update_indexes['messages']['sender_type']); upd_alter_table('messages', array("ADD INDEX `i_owner_time` (`message_owner`, `message_time`)", "ADD INDEX `i_sender_time` (`message_sender`, `message_time`)", "ADD INDEX `i_time` (`message_time`)"), !$update_indexes['messages']['i_owner_time']); upd_drop_table('fleet_log'); upd_do_query("UPDATE `{{planets}}` SET `metal` = 0 WHERE `metal` < 0;"); upd_do_query("UPDATE `{{planets}}` SET `crystal` = 0 WHERE `crystal` < 0;"); upd_do_query("UPDATE `{{planets}}` SET `deuterium` = 0 WHERE `deuterium` < 0;"); upd_alter_table('planets', array("DROP COLUMN `b_building`", "DROP COLUMN `b_building_id`"), $update_tables['planets']['b_building']); upd_do_query("DELETE FROM {{config}} WHERE `config_name` IN ('noobprotection', 'noobprotectionmulti', 'noobprotectiontime', 'chat_admin_msgFormat');"); upd_do_query("DELETE FROM `{{logs}}` WHERE `log_code` = 501;"); upd_do_query("DELETE FROM `{{logs}}` WHERE `log_title` IN ('Canceling Hangar Que', 'Building Planet Defense');"); upd_check_key('chat_admin_highlight', '<font color=purple>$1</font>', !isset($config->chat_admin_highlight)); upd_check_key('int_banner_URL', 'banner.php?type=banner', $config->int_banner_URL == '/banner.php?type=banner'); upd_check_key('int_userbar_URL', 'banner.php?type=userbar', $config->int_userbar_URL == '/banner.php?type=userbar'); upd_do_query('DELETE FROM {{aks}} WHERE `id` NOT IN (SELECT DISTINCT `fleet_group` FROM {{fleets}});'); upd_alter_table('users', 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'); if (!$update_tables['shortcut']) { upd_create_table('shortcut', "(\n `shortcut_id` SERIAL,\n `shortcut_user_id` BIGINT(11) UNSIGNED NOT NULL DEFAULT 0,\n `shortcut_planet_id` bigint(11) NOT NULL DEFAULT 0,\n `shortcut_galaxy` int(3) NOT NULL DEFAULT 0,\n `shortcut_system` int(3) NOT NULL DEFAULT 0,\n `shortcut_planet` int(3) NOT NULL DEFAULT 0,\n `shortcut_planet_type` tinyint(1) NOT NULL DEFAULT 1,\n `shortcut_text` NVARCHAR(64) NOT NULL DEFAULT '',\n\n PRIMARY KEY (`shortcut_id`),\n KEY `i_shortcut_user_id` (`shortcut_user_id`),\n KEY `i_shortcut_planet_id` (`shortcut_planet_id`),\n\n CONSTRAINT `FK_shortcut_user_id` FOREIGN KEY (`shortcut_user_id`) REFERENCES `{$config->db_prefix}users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $temp_planet_types = array(PT_PLANET, PT_DEBRIS, PT_MOON);