Gossamer Forum
Home : Products : Others : Gossamer Community :

import.pl - mapfile?

Quote Reply
import.pl - mapfile?
Hi,

Got a really annoying problem :| Basically, we have GForum setup (2000+ users) ... and I've just setup Community + Glinks.

The problem is, that the users don't exist :|

I've found "import.pl" .. in the /tools folder, but I can't get it to work.

The "help" shows;

Quote:
perl import.pl --help

Usage: import.pl --type=s --path=s [--mapfile=s] [--table=s] [--help]

--type The Gossamer's products ID which are named gforum, gmail, lsql and dbsql.
--path This should be the PATH (starts with a / or a drive letter) to the directory where your admin files are.
No trailing slash please.
--mapfile This is an option which should be the PATH to the map files.
--table This argument is required for DBMan SQL product only. 'table' should be the name of user table.

Problem is, it won't import Unimpressed

Quote:
import.pl --type=gforum --path=/var/home/user/domain.com/cgi-bin/admin --mapfile=/var/home/user/domain.com/secure_data/lib
/Community/Import/maps/gforum.map
Failed to execute query: 'SELECT HASH(0x8296b34),sub {
# --------------------------------------------------
my ( $mappings, $tags ) = @_;
$tags->{app_keyword} and $mappings->{"app_$tags->{app_keyword}_user_id"}
= "user_id";
} FROM gforum_User WHERE (user_status >= ?)' Reason: You have an error in yo
ur SQL syntax. Check the manual that corresponds to your MySQL server version f
or the right syntax to use near '(0x8296b34),sub {
# --------------------------------------- at /var/home/user/domain.com/
secure_data/lib/Community/Import/GForum.pm line 58.

Anyone got any ideas? :/

TIA

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] import.pl - mapfile? In reply to
Wow, that was a mission :/

For anyone else having the same problem in the future, here's what I did Smile

1) Export the data from Community, in the following format (using pipe as the delimiter);

comm_username|comm_password|comm_email|prof_first_name|prof_last_name

2) Once you have that data, make a new script called copyfromcomm.cgi, and put the following code into it;

Code:
#!/usr/local/bin/perl

use strict;
use lib '/path/to/your/glinks/admin';
use Links qw/$IN $DB $CFG/;
use CGI::Carp qw(fatalsToBrowser);

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

Links::init('/path/to/your/glinks/admin');

# get rid of existing users in lsql_Users ... THIS IS FOR A CLEAN INSTALL OF GLINKS ONLY .. COMMENT THIS LINE OUT OF YOU ALREADY HAVE USERS IN GLINKS!
$DB->table('Users')->delete_all();

while (<DATA>) {

my ($comm_username,$comm_password,$comm_email,$prof_first_name,$prof_last_name) = split /\|/, $_;

print qq|Working on $comm_username \n|;

my $user;
$user->{Username} = $comm_username;
$user->{Password} = $comm_password;
$user->{Email} = $comm_email;
$user->{Name} = '';
$user->{Status} = 'Registered';

use Data::Dumper;
print Dumper($user);

$DB->table('Users')->insert($user) || die $GT::SQL::error;

}



__DATA__
Lily|$GT$3HE/9cNz$IglmtS/pbqExrXi10RnVa0|none@none.com|Lily|none@none.com
Lily|$GT$3HE/9cNz$IglmtS/pbqExrXi10RnVa0|none@none.com|Lily|none@none.com
Lily|$GT$3HE/9cNz$IglmtS/pbqExrXi10RnVa0|none@none.com|Lily|none@none.com
Lily|$GT$3HE/9cNz$IglmtS/pbqExrXi10RnVa0|none@none.com|Lily|none@none.com
...etc

Please note, you need to enter the values from step 1 below the __DATA__ part for it to know who to import =)

Also, be sure to miss the first line out.. as that is just a list of the field definitions :P

3) Now, run the script :D

cd /path/to/admin
perl copyfromcomm.cgi

..and see what it outputs :)

Hope that helps someone. It's been screwing with my head all morning Unimpressed

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] import.pl - mapfile? In reply to
You could just use mysqlman to re-import the data Cool
Quote Reply
Re: [Hargreaves] import.pl - mapfile? In reply to
Erm, from the comm_users table into the lsql_Users table, me thinks not Tongue

I'm not that stupid ;)

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!