FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » add forums / groups to FUDForum directly through MySQL
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
add forums / groups to FUDForum directly through MySQL [message #12366] Wed, 06 August 2003 13:11 Go to next message
bbarnett is currently offline  bbarnett   Canada
Messages: 19
Registered: March 2003
Karma: 0
Junior Member


I've seen a few scripts in PHP that do this (conversion scripts), but they seem to be heavily mired in FUDForum's own code.

I would like to add (and delete.. or disable) Forums through Perl. Is it as easy as a few insert statements? It looks to me like the conversion scripts are calling a lot of sub routines to decide various variables.

Can I just do a MAX of a few columns, and figure out what to add from that?
Re: add forums / groups to FUDForum directly through MySQL [message #12367 is a reply to message #12366] Wed, 06 August 2003 13:21 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Adding a forum is not exactly easy manually mostly because it involves adding a group as well. You can do it via perl by essentially duplicating all of the SQL queries pefromed by PHP.

FUDforum Core Developer
Re: add forums / groups to FUDForum directly through MySQL [message #12373 is a reply to message #12367] Wed, 06 August 2003 13:36 Go to previous messageGo to next message
bbarnett is currently offline  bbarnett   Canada
Messages: 19
Registered: March 2003
Karma: 0
Junior Member

Right, I know that.

However, I find FUDForum code hard to follow.. there are no comments of any sort in it that help me. I'm not insulting FUDForum, sometimes some of my code lacks well commented info in it as well.

However, I was just hoping that someone could tell me what SQL queries I would need to do to add a group + forum to FUDForum. Again, when I look at the conversion scripts, they seem to hit tons of FUD subroutines, and get data from them about adding Forums...

Do they just do a MAX and add a forum / group ID at the top of the chain? I have this from one conversion script:

$gid = q_singleval("SELECT id FROM ".$DBHOST_TBL_PREFIX."groups WHERE res='forum' AND res_id=".$id);
q("UPDATE ".$DBHOST_TBL_PREFIX."groups SET res_id=".$obj->forumid." WHERE id=".$gid);
q("UPDATE ".$DBHOST_TBL_PREFIX."group_resources SET resource_id=".$obj->forumid." WHERE group_id=".$gid);
q("UPDATE ".$DBHOST_TBL_PREFIX."forum SET id=".$obj->forumid." WHERE id=".$id);

Can I set my missing variables by doing another query that I don't see here? Such as $id and such? Can I get $id by just doing a MAX on a particular column? What about forumid and gid? Again, I can set these with MAX or what?

And, afterwords, do I have to do a consistancy check after it runs? If so, can I run this from bash?
Re: add forums / groups to FUDForum directly through MySQL [message #12385 is a reply to message #12373] Wed, 06 August 2003 18:15 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Looking at a converter is generally a bad idea unless you are looking at writing a conversion script.
Instead take a look inside include/forum_adm.inc, speficially the add() method. For group code look @ groups_adm.inc inside the same directory.


FUDforum Core Developer
Re: add forums / groups to FUDForum directly through MySQL [message #12456 is a reply to message #12385] Fri, 08 August 2003 13:08 Go to previous messageGo to next message
bbarnett is currently offline  bbarnett   Canada
Messages: 19
Registered: March 2003
Karma: 0
Junior Member
OK.. I'm working through that....

What about a consitancy check? Is this required? Is there an easy way to call it from bash?
Re: add forums / groups to FUDForum directly through MySQL [message #12458 is a reply to message #12456] Fri, 08 August 2003 13:12 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
If you've executed all the queries that are normally run cosnsistency check is not necessary.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Reimport Causing Indexing Problems
Next Topic: How to change additional smilley window size?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 04:58:57 GMT 2024

Total time taken to generate the page: 0.02594 seconds