예제 #1
0
            upd_alter_table('planets', "DROP KEY `I_planet_protector`", $update_indexes['planets']['I_planet_protector']);
            upd_alter_table('planets', "DROP KEY `I_interceptor_misil`", $update_indexes['planets']['I_interceptor_misil']);
            upd_alter_table('planets', "DROP KEY `I_interplanetary_misil`", $update_indexes['planets']['I_interplanetary_misil']);
        }
        // #ctv
        upd_do_query('COMMIT;', true);
        $new_version = 40;
    case 40:
        upd_log_version_update();
        upd_do_query('COMMIT;', true);
        //    $new_version = 41;
}
upd_log_message('Upgrade complete.');
upd_do_query('SET FOREIGN_KEY_CHECKS=1;', true);
classSupernova::$cache->unset_by_prefix('lng_');
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}");
}
$config->db_loadAll();
/*
if($user['authlevel'] >= 3) {
  print(str_replace("\r\n", '<br>', $upd_log));
}
*/
unset($sn_cache->tables);
sys_refresh_tablelist();
upd_log_message('Restoring server status');
$config->db_saveItem('game_disable', $old_server_status);
예제 #2
0
function upd_alter_table($table, $alters, $condition = true)
{
    global $config, $update_tables;
    if (!$condition) {
        return;
    }
    upd_add_more_time();
    $alters_print = is_array($alters) ? dump($alters) : $alters;
    upd_log_message("Altering table '{$table}' with alterations {$alters_print}");
    if (!is_array($alters)) {
        $alters = array($alters);
    }
    $alters = implode(',', $alters);
    // foreach($alters as $table_name => )
    $qry = "ALTER TABLE {$config->db_prefix}{$table} {$alters};";
    //$result = db_query($qry);
    $result = upd_do_query($qry);
    $error = db_error();
    if ($error) {
        die("Altering error for table `{$table}`: {$error}<br />{$alters_print}");
    }
    upd_load_table_info($table, false);
    return $result;
}
예제 #3
0
파일: update.php 프로젝트: sonicmaster/RPG
function upd_alter_table($table, $alters, $condition = true)
{
    global $config;
    if (!$condition) {
        return;
    }
    upd_add_more_time();
    $alters_print = is_array($alters) ? dump($alters) : $alters;
    upd_log_message("Altering table '{$table}' with alterations {$alters_print}");
    if (!is_array($alters)) {
        $alters = array($alters);
    }
    $qry = "ALTER TABLE {$config->db_prefix}{$table} " . implode(',', $alters) . ';';
    $result = mysql_query($qry);
    $error = mysql_error();
    if ($error) {
        die("Altering error for table `{$table}`: {$error}<br />{$alters_print}");
    }
    upd_load_table_info($table, false);
    return $result;
}