Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Has_Changed_Links never set to 'Yes'

Quote Reply
Has_Changed_Links never set to 'Yes'
Hi,

for some reason the Has_Changed_Links column in the category table is never set to 'Yes', although there definitely are modified Links in several categories.

I wonder if this happens only at my site and what's the reason for this. Any ideas anyone?


Andreas
http://www.archaeologie-online.de
Quote Reply
Re: Has_Changed_Links never set to 'Yes' In reply to
Hi,

there seems to be a bug in sub build_changed_flags in Links/Build.pm:

in line 680 ff.:

Code:
# Update the category flags.
my $catlink_db = $DB->table ('Links', 'CatLinks');
my $cat_db = $DB->table ('Category');
$cat_db->indexing(0);
$cat_db->update ( { Has_Changed_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 } );
my $sth = $catlink_db->select ( { isChanged => 'Yes' }, ['CategoryID', 'Add_Date'] );
while (my ($cat_id, $date) = $sth->fetchrow_array) {
my $parents = $cat_db->parents ($cat_id);
my $str = '(' . join (',', $cat_id, @$parents) . ')';
$cat_db->update ( { Newest_Link => $date, Has_New_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } );
}
should be:

Code:
# Update the category flags.
my $catlink_db = $DB->table ('Links', 'CatLinks');
my $cat_db = $DB->table ('Category');
$cat_db->indexing(0);
$cat_db->update ( { Has_Changed_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 } );
my $sth = $catlink_db->select ( { isChanged => 'Yes' }, ['CategoryID', 'Mod_Date'] );
while (my ($cat_id, $date) = $sth->fetchrow_array) {
my $parents = $cat_db->parents ($cat_id);
my $str = '(' . join (',', $cat_id, @$parents) . ')';
$cat_db->update ( { Has_Changed_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } );
}
At least after changing Build.pm as described and setting isChanged to 'No' manually via SQL all categories with changed links are flagged accordingly and showing the 'updated' icon on my pages after all.

Manually setting isChanged to 'No' is necessary because the code above comes into action only if there are links that were modified (Mod_Date >= Add_Date) but their isChanged value is not set to 'Yes' (see lines 671 - 678 in Build.pm).

Best regards

Andreas
http://www.archaeologie-online.de
Quote Reply
Re: [Digger] Has_Changed_Links never set to 'Yes' In reply to
 
Update for LinksSQL 2.1:

This bug still lives. Unsure

in /cgi-bin/links/admin/Links/Build.pm in build_changed_flags, around line 770:

Code:
# Update the category flags.
my $catlink_db = $DB->table ('Links', 'CatLinks');
my $cat_db = $DB->table ('Category');
$cat_db->indexing(0);
$cat_db->update ( { Has_Changed_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 } );
my $sth = $catlink_db->select ( { isChanged => 'Yes' }, ['CategoryID', 'Add_Date'] );
while (my ($cat_id, $date) = $sth->fetchrow_array) {
my $parents = $cat_db->parents ($cat_id);
my $str = '(' . join (',', $cat_id, @$parents) . ')';
$cat_db->update ( { Newest_Link => $date, Has_New_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } );
}

should be:

Code:
# Update the category flags.
my $catlink_db = $DB->table ('Links', 'CatLinks');
my $cat_db = $DB->table ('Category');
$cat_db->indexing(0);
$cat_db->update ( { Has_Changed_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 } );
my $sth = $catlink_db->select ( { isChanged => 'Yes' }, ['CategoryID', 'Add_Date'] );
while (my ($cat_id, $date) = $sth->fetchrow_array) {
my $parents = $cat_db->parents ($cat_id);
my $str = '(' . join (',', $cat_id, @$parents) . ')';
$cat_db->update ( { Newest_Link => $date, Has_Changed_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } );
}

Andreas
-------------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: [Digger] Has_Changed_Links never set to 'Yes' In reply to
Oops,

that didn't do it.
Sorry for all readers - the above code doesn't fix the problem (although it doesn't do any harm either).

There must be another reason why all categories still have 'Has_Changed_Links' = 'No' Crazy

Any other ideas?

Andreas
-------------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: [Digger] Has_Changed_Links never set to 'Yes' In reply to
Andreas,

In case you haven't managed to fix this yet - this is what I've changed in the sub and it is now working on my site. Hope it helps.

Laura.

$SUBS{build_changed_flags} = <<'END_OF_SUB';
sub build_changed_flags {
# ------------------------------------------------------------------
# Update isChanged flags, based on Mod_Date.
#
Links::init_date();
my $opts = shift || {};
my $date = GT::Date::date_sub ( GT::Date::date_get(), $CFG->{build_new_cutoff} );
my $link_db = $DB->table('Links');
$link_db->indexing(0);
my $cond = GT::SQL::Condition->new(
GT::SQL::Condition->new (
'isChanged', '=', 'Yes',
'Mod_Date', '<', $date,
'isValidated', '=', 'Yes'
),
GT::SQL::Condition->new (
'isChanged', '=', 'Yes',
'isNew', '=', 'Yes',
'isValidated', '=', 'Yes'
),
'OR'
);
my $old_rows = $link_db->count ( $cond );
if ($old_rows > 0) {
$link_db->update ( { isChanged => 'No' }, $cond, { GT_SQL_SKIP_CHECK => 1 } );
}
$cond = GT::SQL::Condition->new (
'isChanged', '=', 'No',
'Mod_Date', '>=', $date,
'Add_Date', '<', $date
);
my $new_rows = $link_db->count($cond);
if ($new_rows > 0) {
$link_db->update ( { isChanged => 'Yes' }, $cond, { GT_SQL_SKIP_CHECK => 1 } );
}
$cond = GT::SQL::Condition->new (
'isChanged','=','Yes',
'isValidated','=','Yes'
);
my $rows = $link_db->count($cond);
if ($rows >0){
# Update the category flags.
my $catlink_db = $DB->table ('Links', 'CatLinks');
my $cat_db = $DB->table ('Category');
$cat_db->indexing(0);
$cat_db->update ( { Has_Changed_Links => 'No' }, {}, { GT_SQL_SKIP_CHECK => 1 } );
my $sth = $catlink_db->select ( { isChanged => 'Yes' }, ['CategoryID'] );
while (my ($cat_id) = $sth->fetchrow_array) {
my $parents = $cat_db->parents ($cat_id);
my $str = '(' . join (',', $cat_id, @$parents) . ')';
$cat_db->update ( { Has_Changed_Links => 'Yes' }, GT::SQL::Condition->new ('ID', 'IN', \$str), { GT_SQL_SKIP_CHECK => 1 } );
}
$cat_db->indexing(1);
}
$link_db->indexing(1);
return $new_rows + $old_rows;
}
END_OF_SUB
Quote Reply
Re: [afinlr] Has_Changed_Links never set to 'Yes' In reply to
Hello,

I have the problem on my directory.

There is a solution suggested by Gossamer ?

Thank you for your assistance.

Mick
Quote Reply
Re: [mick31] Has_Changed_Links never set to 'Yes' In reply to
That was over a year ago. Have you upgraded to the most current links version?

Have you repaired your tables?

Are you running a dyamic site? There are some things triggered in a build that don't seem to be triggered when you run dynamically.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Has_Changed_Links never set to 'Yes' In reply to
Hello Pugdog,

The problem is on dynamics and it on statics.

I use version 2.1.2 of Links SQL.

I repaired the tables and reindexer.

But, there is always the problem.

I is not found of solution.

The problem is with subcategory.html.

No problem for link.html

An idea?

Thank you for your assistance.

Mick