Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Importing links while keeping existing

Quote Reply
Importing links while keeping existing
I have a Links 3.x installation with existing categories and links. Is it possible to import more categories and links from another installation I have on the same site/server, which is Links 2.x. I think if I do a normal import it will overwrite all existing data in the database, whereas I really want to "merge" the data.

Many thanks. I couldn't find any reference to this in documentation or forums, my apologies if I missed something.

Thanks,
--Jo
Quote Reply
Re: [iplay] Importing links while keeping existing In reply to
Hi,

Is it just categories you want to "merge" over?

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] Importing links while keeping existing In reply to
Andy, it's everything.

Eg, Links 3.x has categories Australia, Brazil, France etc with links in them.

I want to keep those and import into Links 3.x other categories with links in them from Links 2.x, for example Airports, Cars, Hotels.

The final directory would end up, for example, as:

Categories:
Airports
Australia
Brazil
Cars
France
Hotels


Thanks,
--Jo
Quote Reply
Re: [iplay] Importing links while keeping existing In reply to
Or maybe I'd do better to use a plugin that I think you make? ie, get the Links 2.x data in a spreadsheet or text file, whatever, and import with the plugin. Would I be able to import selectively like that? In other words, I don't want to import all of the categories from the old installation.

Thanks,
--Jo
Quote Reply
Re: [iplay] Importing links while keeping existing In reply to
Hi,

Ok, there's no real simple way to do this :D

Whats your MAX LinkID, and MAX Category ID ? I'll give you some commands to run, which should work :) (quite long winded though - and obviously backup both your DB's first =))

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: [iplay] Importing links while keeping existing In reply to
Hi,

iplay wrote:
Or maybe I'd do better to use a plugin that I think you make? ie, get the Links 2.x data in a spreadsheet or text file, whatever, and import with the plugin. Would I be able to import selectively like that? In other words, I don't want to import all of the categories from the old installation.

Yeah, that may be easier.

Export with a .cgi (I'll write one for you in a min =))

Then, import it all into your Database, with Data_Import (this will create the categories for you then too, as well as adding the links)

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: [iplay] Importing links while keeping existing In reply to
Hi,

This should work (to get the data out);

Code:
#!/usr/bin/perl

use strict;
use lib './admin';
use GT::Base;
use GT::Plugins qw/STOP CONTINUE/;
use Links qw/$CFG $IN $DB/;
use Links::Plugins;
use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
use GT::Date;

Links::init('./admin');

my $sth = $DB->table('CatLinks')->select;

print qq|Title Cat_Full_Name URL Description\n|;
while (my $hit = $sth->fetchrow_hashref) {

my $link = $DB->table('Links')->select( { ID => $hit->{LinkID} } )->fetchrow_hashref;
my $cat = $DB->table('Category')->select( { ID => $hit->{CategoryID} } )->fetchrow_hashref;

print qq|$link->{Title} $cat->{Full_Name} $hit->{URL} $hit->{Description}\n|;

}

..save as get_data.cgi, and upload into the OLD LSQL 2 admin area,? CHMOD to 755 - then run from your browser.

Then, view the source, and should have create a tab delimited data list (of your links , from the old install).

Let me know if that works 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!

Last edited by:

Andy: Apr 28, 2008, 6:53 AM
Quote Reply
Re: [Andy] Importing links while keeping existing In reply to
Hi Andy, thanks. I was away for a bit. I'll get your plugin and try the script you kindly provided.

Many thanks Smile

Thanks,
--Jo
Quote Reply
Re: [iplay] Importing links while keeping existing In reply to
Hi,

NP.

BTW, that only extracts the Title, URL, Description and Category Name - but if you want more stuff, lemme know =)

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!