Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How Can I Reset Link ID?

Quote Reply
How Can I Reset Link ID?
Two of my glinks installs were being hit hard by spammers, so the link ID numbers are insanely high

On one of them the ID is has gone past 55 million, while on the other the link ID is in the high thousands

What I'd like to do is reset the link IDs ie. update all existing links to use consecutive IDs and thus remove the rather large gaps in the ID numbers

It used to be quite easy to do this using the old flatfile version of Links, but I've no idea what the safest and sanest way of doing it on glinks sql would be

TIA

Michele
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [blacknight] How Can I Reset Link ID? In reply to
Hi,

How exactly are they scattered about? i.e do you have LOADS of spam, i.e goes from 50,000 ---> the top number, which are all spam - OR are there some links in the middle of the spam numbers, which are actually valid links? The first option is simple to do - but the second one would be a lot harder :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How Can I Reset Link ID? In reply to
Andy

I've got valid links - big gap - valid links - big gap - valid links - small gap etc., etc.,

Michele
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [blacknight] How Can I Reset Link ID? In reply to
Mmm... that not very simple then :/

What you need to do - is firstly - move all the linkID's "down" in the list.

For example, if the valid listing, before the big gap of spam is ID 12345, then the next one would need to be 12346.

..and thats where the problem comes in :(

The best way to do it really - is to have a script, which would go through and re-make the ID number - and based on the last "good" link you have (i.e before the big gap), it would then update the glinks_Links/glinks_CatLinks table - with these new LinkIDs. This could be a dangerous process though, and its always a good idea to backup your DB, before you do anything like that =)

However, thats not as simple as it sounds Frown

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How Can I Reset Link ID? In reply to
I think I'll bribe one of my programmers to do it during their lunch break :)
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [blacknight] How Can I Reset Link ID? In reply to
haha ok - just be careful, and BE SURE to backup the tables first (nothing worse than screwing up your database ;))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How Can I Reset Link ID? In reply to
I'll backup the entire database before doing anything silly :)
Blacknight Solutions - Hosting
Search.ie
Armchair.ie
Quote Reply
Re: [blacknight] How Can I Reset Link ID? In reply to
It's pretty simple to do. You just need some Perl code to insert a new ID into each record but make sure you update the CatLinks table too. Actually, I think the database module updates all foreign keys automatically.

When someone creates a new record the ID will still start at the last ID MySQL recognizes which will be 50 million or whatever the last ID was so if that's a problem you may need to look into ways of resetting the auto increment ID in MySQL.