Advertisement:

Bulk-load boards at the db level

Aloittaja jeffmacguy, huhtikuu 02, 2008, 11:57:53 AP

« edellinen - seuraava »

jeffmacguy

Could someone tell me if it is possible to write a MySQL sql statement to insert a group of boards into a site. I would like to create individual boards for each US state and some sub-sets within the states and I don't look forward to the tedium of doing this through the user interface.

Any help would be appreciated.


CmptrWz

It is possible, yes. How proficient are you with mysql?

jeffmacguy

proficient enough to not try anything on a production system... If I can make it work in test, then I'd give it a go on prod, after a full backup, of course.

CmptrWz

At the very least you will need to insert into the boards table, perhaps the categories table as well. You may need to pre-prepare your data for ordering and subboard purposes as well, so you know what the other board IDs are. But, if you do it correctly, it should work.

H

-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

jeffmacguy

Thanks for the replies.

Huw: Can you provide an example of the input?

Thanks

H

Say you had already made a category for these boards and then had all the US states in an array:

Example:


$usstates 
= array('New Jersey''New York');]


You could do:


require('/path/to/ssi.php');
require(
'/path/to/Sources/Subs-Boards.php');

$boardoptions = array (
 
'board_name' => 'name',
 
'inherit_permissions' => false,
 
'move_to' => 'no',
 
'target_category' => 1//Change number to the category ID
)

foreach(
$usstate as $state)
{
   
$boardoptions['board_name'] = $state;
   
createboard($boardoptions);
}


I haven't tested this code but I think it should work :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

metallica48423

will throw an error if you try to direct load Subs-Boards, i believe.

add define('SMF', '1'); before you do anything.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

LainaaMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

H

Lainaus käyttäjältä: metallica48423 - huhtikuu 03, 2008, 04:27:46 IP
will throw an error if you try to direct load Subs-Boards, i believe.

add define('SMF', '1'); before you do anything.

AFAIK this is already defined in SSI.php
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

metallica48423

Hm.  Possibly.  Its been awhile since i've done anything like this in conjunction with SSI :P
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

LainaaMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

jeffmacguy

Cool... thanks for the reply. I'll give it a shot and report on the results.

Advertisement: