Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Importing Slashcode Database

Quote Reply
Importing Slashcode Database
I'm thinking about merging an existing slashcode stories table into an existing gforum posts table. I'd like to dump the entire archive (only a 100 stories or so) into a single forum - no users, or sub-posts - just single top-level posts.

The table is similar, but completely different than the posts database. I've reviewed some of the import scripts, but I'm a little lost.

Can I just rename / add / drop fields in my older stories table to resemble the posts table then import - presuming the fields are equal?

Any tips on converting 2001-11-28 12:45:42 time to a unix format?

Any other tips / thoughts in general?



Thanks!

-j
Quote Reply
Re: [DoubleJJ] Importing Slashcode Database In reply to
OK - I tried hacking my way into this, the results were not great, but a good start, no permanent damage I hope. I tried swapping my new altered Post table with the standard Post table. I immediately swapped back due to funkiness. Geez, this was tougher than I expected, but I'm nearly there I think.

I wrote a php script to change the old dates into the unix style date and also to transfer the stories into the Post table. I filled in the remaining "blanks" with data (like post_ip - username.. etc) and assigned all the stories into one specific forum. I must have missed something.. because the results were not as great as I'd hoped.

The forum worked, the posts appeared - but the counts on the main page were wrong. I have 129 stories, but it only listed 1 (my initial test post). Any ideas? Where is this variable set?

Also, I uncovered a potential bug with the "Disable Forum" feature. When you disable the forum and allow "only admins" I get some funkiness going on. My "forum disabled" html message gets written as text "<br>The Forum is Disabled<br>..." and I can't login as an admin.

Any hints would be appreciated.

-j
Quote Reply
Re: [DoubleJJ] Importing Slashcode Database In reply to
If you run this from the command line, it ought to fix up the post count. GForum internally does this every time a post is added using the GForum interface.

perl -e 'use GForum qw/$DB/; GForum::init("/path/to/your/admin"); $DB->table("Forum")->rebuild(123)'

Replace /path/to/your/admin, and 123 with the id of the forum in question.

The "except for admins" disabling feature requires that you log into the forum as an administrator _before_ disabling - since it is disabled to regular users and guests, you can't load the login page.

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Importing Slashcode Database In reply to
Thanks! I'll try it,

also...

Any ideas why the "disabled message" is funky when you "enable admins" to login while the forum is closed? Mine looks like normal when "all" are disabled from entry, but the "enable admins" option prints the disabled message (you see the HTML) like below.

"<b>Forum is Closed</b><br>chack back later"
Quote Reply
Re: [DoubleJJ] Importing Slashcode Database In reply to
Yeah... It's a bug Blush

In gforum.cgi, look for this:

Code:
if ($CFG->{disabled} == 2 and (not $USER or $USER->{user_status} != ADMINISTRATOR)) {
print $IN->header;
return GForum::Template->parse_print("disabled.html" => { message => $CFG->{disabled_message} });
}

If you change it to this, it'll allow HTML properly (and automatically convert newlines into <br>'s):

Code:
if ($CFG->{disabled} == 2 and (not $USER or $USER->{user_status} != ADMINISTRATOR)) {
print $IN->header;
my $message = $CFG->{disabled_message};
$message =~ s/\n/<br>\n/g;
return GForum::Template->parse_print("disabled.html" => { message => \$message });

}

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Importing Slashcode Database In reply to
Cool - that works.

I've tried the "fix" (let me clarify - your perl fix for the counts not being correct in the main forum page) but that does not seem to work. I get the below:

Can't locate GForum.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Last edited by:

DoubleJJ: Jan 31, 2003, 8:40 PM
Quote Reply
Re: [DoubleJJ] Importing Slashcode Database In reply to
Either run it from your admin directory, or change 'perl -e' to 'perl -I/path/to/your/admin -e'

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Quote Reply
Re: [Jagerman] Importing Slashcode Database In reply to
OK - I got the post number listing to refresh (my error - I was trying to type the actual database name - in my case gforum_Forum instead of just Forum). It worked fine - but now another problem arises.

How can get the posts to appear in chronological order - newest to oldest? Currently, they showup from with oldest on first page and newest on last.
Quote Reply
Re: [DoubleJJ] Importing Slashcode Database In reply to
How many posts do you have?

This code should be able to help you - but be warned, it will take a very long time on a large forum:

$DB->table("Post")->rebuild_latest($DB->table("Post")->select("post_id")->fetchall_list);

Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com