Create new forums using SQL

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Scam Warning
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
potiron
Registered User
Posts: 61
Joined: Wed Dec 01, 2004 9:55 am

Create new forums using SQL

Post by potiron »

Hi,

I need to create 220 forums (yes, 1 forum per country ;) )
Of course I could use the ACP but it will take me AGES... therefore I want to prepare the SQL request in excel and apply them to the DB.

I would be grateful for any help to tell me how to write a SQL query to create a new forum directly.

Thanks in advance for any help :P
Last edited by Pit$Bull on Wed Feb 17, 2010 9:17 pm, edited 1 time in total.
Reason: Topic icon changed
Pit$Bull
Former Team Member
Posts: 23099
Joined: Sat Dec 02, 2006 4:08 pm
Name: Can't Remember

Re: Create new forums using SQL

Post by Pit$Bull »

It would be faster and easier to use the ACP as intended.
potiron
Registered User
Posts: 61
Joined: Wed Dec 01, 2004 9:55 am

Re: Create new forums using SQL

Post by potiron »

I think the only impacted forum is:
phpbb3_forums

Therefore a request to create a new category + new forum would be:

Code: Select all

INSERT INTO `phpbb3_forums` (`forum_id`, `parent_id`, `left_id`, `right_id`, `forum_parents`, `forum_name`, `forum_desc`, `forum_desc_bitfield`, `forum_desc_options`, `forum_desc_uid`, `forum_link`, `forum_password`, `forum_style`, `forum_image`, `forum_rules`, `forum_rules_link`, `forum_rules_bitfield`, `forum_rules_options`, `forum_rules_uid`, `forum_topics_per_page`, `forum_type`, `forum_status`, `forum_posts`, `forum_topics`, `forum_topics_real`, `forum_last_post_id`, `forum_last_poster_id`, `forum_last_post_subject`, `forum_last_post_time`, `forum_last_poster_name`, `forum_last_poster_colour`, `forum_flags`, `forum_options`, `display_subforum_list`, `display_on_index`, `enable_indexing`, `enable_icons`, `enable_prune`, `prune_next`, `prune_days`, `prune_viewed`, `prune_freq`) VALUES
(99, 0, 1, 4, '', 'Countries', 'Forums by country', '', 7, '', '', '', 0, '', '', '', '', 7, '', 0, 0, 0, 0, 0, 0, 0, 0, '', 0, '', '', 48, 0, 1, 0, 1, 0, 0, 0, 7, 7, 1),
(100, 99, 2, 3, '', 'Afghanistan', 'أفغانستان, Afghanistan, Afganistán, Afghanistan, Αφγανιστάν, アフガニスタン, Afghanistan, Afghanistan, Afganistan, Afeganistão, Афганистан, 阿富汗, 阿富汗', '', 7, '', '', '', 0, '../images/flags/af.png', '', '', '', 7, '', 0, 1, 0, 0, 0, 0, 0, 0, '', 0, '', '', 48, 0, 1, 0, 1, 0, 0, 0, 7, 7, 1);
If anybody can confirm that I am not making a huuuuuuuuuuuuge error! :? ;)

Oh in addition I noticed that there is a need to increment the value of the 3rd and 4th, being 2,3 for the first forum, 4,5 for the second...etc
potiron
Registered User
Posts: 61
Joined: Wed Dec 01, 2004 9:55 am

Re: Create new forums using SQL

Post by potiron »

Ok OK I might give up... inserting new forum lines is mixing all categories and order... there is somewhere else to change orders, I don't now where...
I will probably do it manually instead :-(
elvar
Registered User
Posts: 3
Joined: Wed Apr 21, 2010 5:32 am

Re: Create new forums using SQL

Post by elvar »

Once upon a time I found the post about the ordering of the forums from backend.

Cant find it now...

Did you found a way how to do it?
User avatar
ric323
Former Team Member
Posts: 22910
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: Create new forums using SQL

Post by ric323 »

potiron wrote:Hi,

I need to create 220 forums (yes, 1 forum per country ;) )
...
This really isn't a good idea. You are going to have to make some tweaks to your board to avoid it running like a dog.
e.g. The "jump to" box on each page is going to contain all 200 forums, so you'd need to remove that to avoid one big slow down.
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions
potiron
Registered User
Posts: 61
Joined: Wed Dec 01, 2004 9:55 am

Re: Create new forums using SQL

Post by potiron »

I haven't noticed any slow down due to the jumpbox... isn't it just a simple SQL query? Can't see how it might slow down...
gimmeg
Registered User
Posts: 24
Joined: Wed Nov 18, 2009 12:44 pm

Re: Create new forums using SQL

Post by gimmeg »

When adding forums like that you will at least have to rebuild the left and right ids which can be done trough the STK. But I didn't test it so I cant promise it will work as expected.

cheers
gimmeg
potiron
Registered User
Posts: 61
Joined: Wed Dec 01, 2004 9:55 am

Re: Create new forums using SQL

Post by potiron »

I probably forgot to say that when it creates the forums, it messes around things (they do not appear un the list, or in different order... can't remember exactly the problem as it was 2 months ago... but it did not work). Therefore I gave up and created manually the forums through the ACP.
Locked

Return to “[3.0.x] Support Forum”