Exemple #1
0
 upd_check_key('eco_planet_storage_crystal', 500000, !isset($config->eco_planet_storage_crystal));
 upd_check_key('eco_planet_storage_deuterium', 500000, !isset($config->eco_planet_storage_deuterium));
 upd_check_key('security_write_full_url_disabled', 1, !isset($config->security_write_full_url_disabled));
 // http://1whois.ru?url=
 upd_check_key('geoip_whois_url', 'https://who.is/whois-ip/ip-address/', !isset($config->core_geoip_whois_url));
 upd_check_key('ube_capture_points_diff', 2, !isset($config->ube_capture_points_diff));
 // 2015-10-17 14:46:32 40a15.5
 upd_check_key('game_users_online_timeout', 15 * 60, !isset($config->game_users_online_timeout));
 // 2015-10-22 14:37:58 40a17.5
 upd_check_key('locale_cache_disable', 0, !isset($config->locale_cache_disable));
 // 2015-10-30 19:09:01 40a19.5
 upd_check_key('event_halloween_2015_lock', 0, !isset($config->event_halloween_2015_lock));
 upd_check_key('event_halloween_2015_unit', 0, !isset($config->event_halloween_2015_unit));
 upd_check_key('event_halloween_2015_code', '', !isset($config->event_halloween_2015_code));
 upd_check_key('event_halloween_2015_timestamp', SN_TIME_SQL, !isset($config->event_halloween_2015_timestamp));
 upd_check_key('event_halloween_2015_units_used', serialize(array()), !isset($config->event_halloween_2015_units_used));
 if (empty($update_tables['log_halloween_2015'])) {
     upd_create_table('log_halloween_2015', " (\n      `log_hw2015_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,\n      `player_id` bigint(20) unsigned NOT NULL COMMENT 'User ID',\n      `player_name` varchar(32) NOT NULL DEFAULT '',\n      `unit_snid` bigint(20) unsigned NOT NULL DEFAULT 0,\n      `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\n      PRIMARY KEY (`log_hw2015_id`),\n      KEY (`player_id`, `log_hw2015_id` DESC) -- For list on Imperator page\n      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;");
 }
 // 2015-11-28 06:30:27 40a19.21
 if (!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) {
     upd_alter_table('ube_report', array("ADD COLUMN `ube_report_debris_total_in_metal` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Total debris in metal'", "ADD KEY `I_ube_report_time_debris_id` (`ube_report_time_process` DESC, `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC)"), !isset($update_tables['ube_report']['ube_report_debris_total_in_metal']));
     $config_rpg_exchange_metal = floatval($config->rpg_exchange_metal) ? floatval($config->rpg_exchange_metal) : 1;
     $config_rpg_exchange_crystal = floatval($config->rpg_exchange_crystal) ? floatval($config->rpg_exchange_crystal) : 1;
     upd_do_query("UPDATE `{{ube_report}}`\n        SET `ube_report_debris_total_in_metal` = (`ube_report_debris_metal` + `ube_report_debris_crystal` * {$config_rpg_exchange_crystal}) / {$config_rpg_exchange_metal}");
 }
 // 2015-12-06 15:10:58 40b1.0
 if (!empty($update_indexes['planets']['I_metal_mine'])) {
     upd_alter_table('planets', "DROP KEY `I_metal`", $update_indexes['planets']['I_metal']);
     upd_alter_table('planets', "DROP KEY `I_ship_sattelite_sloth`", $update_indexes['planets']['I_ship_sattelite_sloth']);
     upd_alter_table('planets', "DROP KEY `I_ship_bomber_envy`", $update_indexes['planets']['I_ship_bomber_envy']);
Exemple #2
0
     $new_version = 34;
 case 34:
     upd_log_version_update();
     upd_alter_table('planets', array("ADD COLUMN `planet_teleport_next` INT(11) NOT NULL DEFAULT 0 COMMENT 'Next teleport time'"), !$update_tables['planets']['planet_teleport_next']);
     upd_check_key('planet_teleport_cost', 50000, !isset($config->planet_teleport_cost));
     upd_check_key('planet_teleport_timeout', PERIOD_DAY * 1, !isset($config->planet_teleport_timeout));
     upd_check_key('planet_capital_cost', 25000, !isset($config->planet_capital_cost));
     upd_alter_table('users', array("ADD COLUMN `player_race` INT(11) NOT NULL DEFAULT 0 COMMENT 'Player\\'s race'"), !$update_tables['users']['player_race']);
     upd_alter_table('chat', array("MODIFY COLUMN `user` TEXT COMMENT 'Chat message user name'"), strtoupper($update_tables['chat']['user']['Type']) != 'TEXT');
     upd_alter_table('planets', array("ADD `ship_sattelite_sloth` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Terran Sloth'", "ADD `ship_bomber_envy` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Lunar Envy'", "ADD `ship_recycler_gluttony` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Mercurian Gluttony'", "ADD `ship_fighter_wrath` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Venerian Wrath'", "ADD `ship_battleship_pride` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Martian Pride'", "ADD `ship_cargo_greed` bigint(20) NOT NULL DEFAULT '0' COMMENT 'Republican Greed'"), !$update_tables['planets']['ship_sattelite_sloth']);
     upd_alter_table('planets', array("ADD `ship_sattelite_sloth_porcent` TINYINT(3) UNSIGNED NOT NULL DEFAULT '10' COMMENT 'Terran Sloth production'", "ADD KEY `I_ship_sattelite_sloth` (`ship_sattelite_sloth`, `id_level`)", "ADD KEY `I_ship_bomber_envy` (`ship_bomber_envy`, `id_level`)", "ADD KEY `I_ship_recycler_gluttony` (`ship_recycler_gluttony`, `id_level`)", "ADD KEY `I_ship_fighter_wrath` (`ship_fighter_wrath`, `id_level`)", "ADD KEY `I_ship_battleship_pride` (`ship_battleship_pride`, `id_level`)", "ADD KEY `I_ship_cargo_greed` (`ship_cargo_greed`, `id_level`)"), !$update_tables['planets']['ship_sattelite_sloth_porcent']);
     upd_check_key('stats_hide_admins', 1, !isset($config->stats_hide_admins));
     upd_check_key('stats_hide_player_list', '', !isset($config->stats_hide_player_list));
     upd_check_key('adv_seo_meta_description', '', !isset($config->adv_seo_meta_description));
     upd_check_key('adv_seo_meta_keywords', '', !isset($config->adv_seo_meta_keywords));
     upd_check_key('stats_hide_pm_link', '0', !isset($config->stats_hide_pm_link));
     upd_alter_table('notes', array("ADD INDEX `I_owner_priority_time` (`owner`, `priority`, `time`)"), !$update_indexes['notes']['I_owner_priority_time']);
     if (!$update_tables['buddy']['BUDDY_ID']) {
         upd_alter_table('buddy', array("CHANGE COLUMN `id` `BUDDY_ID` SERIAL COMMENT 'Buddy table row ID'", "CHANGE COLUMN `active` `BUDDY_STATUS` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Buddy request status'", "CHANGE COLUMN `text` `BUDDY_REQUEST` TINYTEXT DEFAULT '' COMMENT 'Buddy request text'", "DROP INDEX `id`", "DROP FOREIGN KEY `FK_buddy_sender_id`", "DROP FOREIGN KEY `FK_buddy_owner_id`", "DROP INDEX `I_buddy_sender`", "DROP INDEX `I_buddy_owner`"), !$update_tables['buddy']['BUDDY_ID']);
         upd_alter_table('buddy', array("CHANGE COLUMN `sender` `BUDDY_SENDER_ID` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Buddy request sender ID'", "CHANGE COLUMN `owner` `BUDDY_OWNER_ID` BIGINT(20) UNSIGNED NULL DEFAULT NULL COMMENT 'Buddy request recipient ID'"), !$update_tables['buddy']['BUDDY_SENDER']);
         $query = upd_do_query("SELECT `BUDDY_ID`, `BUDDY_SENDER_ID`, `BUDDY_OWNER_ID` FROM {{buddy}} ORDER BY `BUDDY_ID`;");
         $found = $lost = array();
         while ($row = db_fetch($query)) {
             $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']) . ';' . max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']);
             if (!isset($found[$index])) {
                 $found[$index] = $row['BUDDY_ID'];
             } else {
                 $lost[] = $row['BUDDY_ID'];
             }
         }
         $lost = implode(',', $lost);
Exemple #3
0
        upd_check_key('uni_galaxy_distance', 20000, empty($config->uni_galaxy_distance));
        upd_check_key('stats_history_days', 14, !$config->stats_history_days);
        if ($config->payment_currency_default != 'USD') {
            upd_check_key('payment_currency_default', 'USD', true);
            upd_check_key('payment_currency_exchange_dm_', 20000, true);
            upd_check_key('payment_currency_exchange_mm_', 20000, true);
            upd_check_key('payment_currency_exchange_usd', 1, true);
        }
        upd_check_key('payment_currency_exchange_wmz', 1.0, true);
        upd_check_key('payment_currency_exchange_eur', 0.9, true);
        upd_check_key('payment_currency_exchange_wme', 0.9, true);
        upd_check_key('payment_currency_exchange_wmb', 18000, !$config->payment_currency_exchange_wmb);
        upd_check_key('payment_currency_exchange_uah', 30, true);
        upd_check_key('payment_currency_exchange_wmu', 30, true);
        upd_check_key('payment_currency_exchange_rub', 60, true);
        upd_check_key('payment_currency_exchange_wmr', 60, true);
        upd_do_query('COMMIT;', true);
        $new_version = 39;
    case 39:
        upd_log_version_update();
        upd_do_query('COMMIT;', true);
        // $new_version = 40;
}
upd_log_message('Upgrade complete.');
upd_do_query('SET FOREIGN_KEY_CHECKS=1;');
if ($new_version) {
    $config->db_saveItem('db_version', $new_version);
    upd_log_message("<font color=green>DB version is now {$new_version}</font>");
} else {
    upd_log_message("DB version didn't changed from {$config->db_version}");
}
Exemple #4
0
         upd_alter_table('users', array("ADD CONSTRAINT `FK_users_ally_id` FOREIGN KEY (`ally_id`) REFERENCES `{$config->db_prefix}alliance` (`id`) ON DELETE SET NULL ON UPDATE CASCADE", "ADD CONSTRAINT `FK_users_ally_name` FOREIGN KEY (`ally_name`) REFERENCES `{$config->db_prefix}alliance` (`ally_name`) ON DELETE SET NULL ON UPDATE CASCADE"), !$update_foreigns['users']['FK_users_ally_id']);
     }
     upd_alter_table('planets', array("MODIFY COLUMN `debris_metal` BIGINT(20) UNSIGNED DEFAULT 0", "MODIFY COLUMN `debris_crystal` BIGINT(20) UNSIGNED DEFAULT 0"), strtoupper($update_tables['planets']['debris_metal']['Type']) != 'BIGINT(20) UNSIGNED');
     $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);");
     while ($illegal_moon_row = mysql_fetch_assoc($illegal_moon_query)) {
         upd_do_query("DELETE FROM {{planets}} WHERE id = {$illegal_moon_row['id']} LIMIT 1;", true);
     }
     upd_check_key('allow_buffing', isset($config->fleet_buffing_check) ? !$config->fleet_buffing_check : 0, !isset($config->allow_buffing));
     upd_check_key('ally_help_weak', 0, !isset($config->ally_help_weak));
     upd_do_query('COMMIT;', true);
     $new_version = 29;
 case 29:
     upd_log_version_update();
     upd_check_key('game_email_pm', 0, !isset($config->game_email_pm));
     upd_check_key('player_vacation_time', 2 * 24 * 60 * 60, !isset($config->player_vacation_time));
     upd_check_key('player_delete_time', 45 * 24 * 60 * 60, !isset($config->player_delete_time));
     upd_create_table('log_dark_matter', "(\r\n        `log_dark_matter_id` SERIAL,\r\n        `log_dark_matter_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Human-readable record timestamp',\r\n        `log_dark_matter_username` varchar(64) NOT NULL DEFAULT '' COMMENT 'Username',\r\n        `log_dark_matter_reason` INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Reason ID for dark matter adjustment',\r\n        `log_dark_matter_amount` INT(10) NOT NULL DEFAULT 0 COMMENT 'Amount of dark matter change',\r\n        `log_dark_matter_comment` TEXT COMMENT 'Comments',\r\n        `log_dark_matter_page` varchar(512) NOT NULL DEFAULT '' COMMENT 'Page that makes entry to log',\r\n        `log_dark_matter_sender` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'User ID which make log record',\r\n\r\n        PRIMARY KEY (`log_dark_matter_id`),\r\n        KEY `i_log_dark_matter_sender_id` (`log_dark_matter_sender`, `log_dark_matter_id`),\r\n        KEY `i_log_dark_matter_reason_sender_id` (`log_dark_matter_reason`, `log_dark_matter_sender`, `log_dark_matter_id`),\r\n        KEY `i_log_dark_matter_amount` (`log_dark_matter_amount`)\r\n      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;");
     upd_do_query('COMMIT;', true);
     $records = 1;
     while ($records) {
         upd_do_query('START TRANSACTION;', true);
         $query = upd_do_query("SELECT * FROM {{logs}} WHERE log_code = 102 order by log_id LIMIT 1000;");
         $records = mysql_numrows($query);
         while ($row = mysql_fetch_assoc($query)) {
             $result = preg_match('/^Player ID (\\d+) Dark Matter was adjusted with (\\-?\\d+). Reason: (.+)$/', $row['log_text'], $matches);
             $reason = RPG_NONE;
             $comment = $matches[3];
             switch ($matches[3]) {
                 case 'Level Up For Structure Building':
                     $reason = RPG_STRUCTURE;
                     break;
Exemple #5
0
            $db_changeset = array();
            $query = upd_do_query("SELECT `id`, `player_artifact_list` FROM {{users}} WHERE `player_artifact_list` IS NOT NULL AND `player_artifact_list` != '' FOR UPDATE");
            while ($row = db_fetch($query)) {
                $artifact_list = explode(';', $row['player_artifact_list']);
                if (!$row['player_artifact_list'] || empty($artifact_list)) {
                    continue;
                }
                foreach ($artifact_list as $key => &$value) {
                    $value = explode(',', $value);
                    if (!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) {
                        unset($artifact_list[$key]);
                        continue;
                    }
                    $db_changeset['unit'][] = upd_db_unit_changeset_prepare($value[0], $value[1], $row);
                }
            }
            upd_db_changeset_apply($db_changeset);
            upd_alter_table('users', "DROP COLUMN `player_artifact_list`", $update_tables['users']['player_artifact_list']);
        }
        upd_alter_table('users', array("DROP COLUMN `spy_tech`", "DROP COLUMN `computer_tech`", "DROP COLUMN `military_tech`", "DROP COLUMN `defence_tech`", "DROP COLUMN `shield_tech`", "DROP COLUMN `energy_tech`", "DROP COLUMN `hyperspace_tech`", "DROP COLUMN `combustion_tech`", "DROP COLUMN `impulse_motor_tech`", "DROP COLUMN `hyperspace_motor_tech`", "DROP COLUMN `laser_tech`", "DROP COLUMN `ionic_tech`", "DROP COLUMN `buster_tech`", "DROP COLUMN `intergalactic_tech`", "DROP COLUMN `expedition_tech`", "DROP COLUMN `colonisation_tech`"), $update_tables['users']['spy_tech']);
        upd_check_key('payment_currency_exchange_dm_', 2500, !$config->payment_currency_exchange_dm_ || $config->payment_currency_exchange_dm_ == 1000);
        upd_check_key('payment_currency_exchange_eur', 0.09259259259259001, !$config->payment_currency_exchange_eur);
        upd_check_key('payment_currency_exchange_rub', 4.0, !$config->payment_currency_exchange_rub);
        upd_check_key('payment_currency_exchange_usd', 0.125, !$config->payment_currency_exchange_usd);
        upd_check_key('payment_currency_exchange_wme', 0.09523809523810001, !$config->payment_currency_exchange_usd);
        upd_check_key('payment_currency_exchange_wmr', 4.1, !$config->payment_currency_exchange_wmr);
        upd_check_key('payment_currency_exchange_wmu', 1.05, !$config->payment_currency_exchange_wmu);
        upd_check_key('payment_currency_exchange_wmz', 0.126582278481, !$config->payment_currency_exchange_wmz);
        upd_do_query('COMMIT;', true);
        $new_version = 37;
}