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

Mising category, and stuff?

Quote Reply
Mising category, and stuff?
Hi. I'm having a bit of a problem when doing a 'build all'. Basically, it falls over on the details page building, with the following error;

Quote:
Building Detailed pages ...
1801474 1648211 1799524 1648192 1648151 1800117 1800116 1799314 1799335 1799722 1800308 1800699 1800705 1801241 1801326 1801362 1801371 1801373 1801377 1801424
1801422 1801423 1801426 1801456
A fatal error has occured:

GT::SQL::Table (2339): Wrong argument passed to this subroutine. Usage: Must pass category id to template_set at /home/httpd/vhosts/townandabout.com/cgi-bin/links/admin/Links/Category.pm line 307.
Please enable debugging in setup for more details.

I think I have managed to track the problem down to the category ID in lsql_CatLinks, pointing to a non existant entry in 'lsql_Category'. I've written the following script, to try and find Links that have non-existant categories assigned to them. The problem is, it doesn't seem to do anything Unsure Just sites there for hours...

Code:
#!/usr/bin/perl

use strict;
use lib '/home/httpd/vhosts/cgi-bin/links/admin';
use Links qw/$IN $DB $CFG/;
use GT::SQL;
use CGI::Carp qw(fatalsToBrowser);


local $SIG{__DIE__} = \&Links::fatal;

Links::init('/home/httpd/vhosts/cgi-bin/links/admin');

########################################

# setup database connection...
my $table = $DB->table('Links');
my $table2 = $DB->table('CatLinks');
my $table3 = $DB->table('Category');
my $sth = $table->select();
my $id;

# go through all the links in the database...
while (my $hit = $sth->fetchrow_hashref) {

# match the ID with entries in lsql_CatLinks....
my $sth2 = $table2->select( { LinkID => $hit->{ID} } );
while (my $hit2 = $sth2->fetchrow_hashref) {

# now check to see if 'Full_Name' actuall holds a value....if not, it can't exist...
my $sth3 = $table3->select( { ID => $hit2->{CategoryID} } );
while (my $hit3 = $sth3->fetchrow_hashref) {
if (!$hit3->{Full_Name}) { print "BAD: " . $hit->{ID} . "\n"; }
}

}



}

Anyone got any ideas?

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] Mising category, and stuff? In reply to
Never mind... figured it out.

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] Mising category, and stuff? In reply to
And the fix was..... :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Mising category, and stuff? In reply to
Going through manually, and finding links that didn't have a category assigned 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] Mising category, and stuff? In reply to
Anyone ever find a faster way to check for links that aren't assigned to categories?
Quote Reply
Re: [craven32] Mising category, and stuff? In reply to
What about something like this:

SELECT ID, CategoryID FROM Links LEFT JOIN CatLinks ON Links.ID = CatLinks.LinkID WHERE CategoryID IS NULL

This should return a list of Link IDs which do not have a category.