AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Fix the mixed SteamIDs in your database (https://forums.alliedmods.net/showthread.php?t=246913)

Impact123 08-24-2014 20:39

Fix the mixed SteamIDs in your database
 
2 Attachment(s)
There were a lot of people who flipped out about the recent steamid change in tf2.
A lot of them have mixed steamids in their database or used scripts to convert them on purpose before the issue was handled in the snapshots.
A few specific tools for specific problems were released (mostly to convert to the new steamid), but i think this is more flexible, at least for mysql specific stuff.
I've written 2 mysql functions to convert from the old to the new format and vise versa. I'm not terrible experienced in writing mysql functions, so please be kind to me.
Before you begin, i take no responsibility for any damage done to your data.

Log into your phpmyadmin account or use your favorite mysql client and execute/import the attached file.

Lets say you have a table named sometable that looks like this:
https://forums.alliedmods.net/attach...1&d=1408926348

To convert the new steamids to old ones you can use this query
PHP Code:

UPDATE sometable AS t
    SET t
.somesteamid SteamID3ToSteamID(t.somesteamid)
WHERE
    t
.somesteamid LIKE '[U:1:%' 

This converts all new steamids (ones that begin with '[U:1:') to the old format.

To convert old id's to the new format (which you probably shouldn't do) you would use this query:
PHP Code:

UPDATE sometable AS t
    SET t
.somesteamid SteamIDToSteamID3(t.somesteamid)
WHERE
    t
.somesteamid LIKE 'STEAM_%' 

That's about it.

Remember to replace sometable with your table name and somesteamid with the field that contains steamids.
For sourcebans that would, by default, be the sb_bans table and the authid field.


All times are GMT -4. The time now is 18:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.