Gossamer Forum
Home : Products : Gossamer Links : Discussions :

[BUG FIX] Links 2 to LSQL 2.x import (L2S2.pm)

Quote Reply
[BUG FIX] Links 2 to LSQL 2.x import (L2S2.pm)
I found a bug in the Links 2 to LSQL 2.x importer module (L2S2.pm).
It is just minor bug, but it can be a bit disturbing in later Links SQL usage.

BUG description:
When importing a Links 2 database, the order of the non-default Links 2 columns is not preserved, when they are created in the SQL table. This means, that our custom fields, which were carefully sorted, grouped will have a random order in the Links SQL 2.x database.

BUG FIX description:
The bug is fixed, by creating the Links SQL 2.x SQL table fields in the same field order, as it was used in the original links.def or category.def files.

BUG FIX code:
The added code parts are highlighted in red.
In /admin/Links/Import/L2S2.pm file:

in line 207
for (grep !$e_non_standard_cols{"${e_prefix}Category"}{$_}, keys %{$i_non_standard_cols{Category}}) {
change to:
for (grep !$e_non_standard_cols{"${e_prefix}Category"}{$_},
sort { @{$Links2::Def::Category::db_def{$a}}[0] <=> @{$Links2::Def::Category::db_def{$b}}[0] }
keys %{$i_non_standard_cols{Category}}) {

in line 440
for (grep !$e_non_standard_cols{"${e_prefix}Links"}{$_}, keys %{$i_non_standard_cols{Links}}) {
change to:
for (grep !$e_non_standard_cols{"${e_prefix}Links"}{$_},
sort { @{$Links2::Def::Links::db_def{$a}}[0] <=> @{$Links2::Def::Links::db_def{$b}}[0] }
keys %{$i_non_standard_cols{Links}}) {

GT staff,
May this bug fix go into Official Bug Fix forum?
Also may be possible added into CVS?
Please confirm.

Best regards,

Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...