Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Feature Request .. Delete all bad links...

Quote Reply
Feature Request .. Delete all bad links...
Just a quick request. Would it be possible to add a feature, whereas you can go in via SSH, and run nph-verify.cgi --delete-bad , so that it will go through all the links that have a bad status? One of my clients has over 4000 bad links, and its still increasing while nph-verify.cgi runs. This is obviously not a fun task to do manually (having to manually delete 25 links at a time via the admin panel).

Any chance of this GT?

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] Feature Request .. Delete all bad links... In reply to
Andy,

Couldn't you just do an SQL delete on the "status" of the link? Then repair the tables?

I believe the repair function now removes orphan catlinks entries if the link is missing. If not, a short script could do it itertively, grab the ID number of the links ready to be deleted, then delete any catlinks entries remaining using an IN or line-by-line delete after the links are purged.

It's not a one-button option, but it would kill off 4000 entries really quickly with a few lines of code. It could probably also be pinned to the admin screen via a plugin, and you can pick the status codes to delete.

More complex ideas would be to delete links that were "bad" or such, if their "bad" status spanned more than 30, 60 or 90 days for example.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Feature Request .. Delete all bad links... In reply to
The problem is that the CatLinks table doesn't get the links removed.. unless you have a SQL command that can remove links from lsql_Links and lsql_CatLinks in one go?

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] Feature Request .. Delete all bad links... In reply to
You should use GT::SQL to delete a link (i.e. $DB->table('Links')->delete($condition) ), then the relevant entries in the CatLinks table are deleted automatically.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Feature Request .. Delete all bad links... In reply to
Yeah, I know... but I was just hoping for a more 'stable' fix.. i.e built into Links SQL. I wrote a script that would get rid of bad links.. but it would be cool if there was something added to nph-verify.cgi or something Smile

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] Feature Request .. Delete all bad links... In reply to
Once the links are deleted from the Links table, on a table reapair, the catlinks table should be updated/deleted. I think this was a concern addressed as the reverse of orphan links a few versions back.

Otherwise, you can do the multiple deletes, as mentioned, using the IN format to delete the catlinks entries. I've not used it for 4000 links, but I have used for for several hundred at a time.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Feature Request .. Delete all bad links... In reply to
Here is a simple script that will delete links where the status code is 404,401,204 and 403. Its pretty simple, and seems to be working on my installation, with 100,000 links. Not sure how it will handle on larger database.

Just thought I would post it, in case anyone else wanted to use it Smile

You need to run it via SSH/Telnet, and it needs to be in your LSQL /admin/ folder.

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!