PDA

View Full Version : Importing Posts


ralle89
02 Jan 2008, 11:08
Hello!
I am working on a script to import the posts from one of my own forums (which I made). And I am now being stopped by the 30 second delay between posts. How can I bypass that delay? It's an import script that imports 1000's.
This is my code:

// posts + thread
/*------------------------------------------------------*\
|-------------------- Thread Setup ----------------------|
\*------------------------------------------------------*/
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');
$threaddm =& datamanager_init('Thread_FirstPost',$vbulletin,ERRTYPE_ARRAY,'threadpost');

$threaddm->set('forumid',$saveforumid);
$threaddm->set('userid',$res['submit']);
if($insert['altname']) {
$threaddm->set('title',htmlspecialchars_decode($insert['altname']));
} else {
$threaddm->set('title',htmlspecialchars_decode($insert['name']));
}
$threaddm->set('pagetext','I submitted this resource');

$threaddm->set('open',1);
$threaddm->set('visible',1);
$threaddm->set('allowsmilie',1);
$threaddm->pre_save();

if(!empty($threaddm->errors)) {
standard_error('The following errors occured: <ul><li>'.implode('</li><li>',$threaddm->errors).'</li></ul>');
} else {
$insert['threadid'] = $threaddm->save();
}

foreach($comm as $c) {
/*------------------------------------------------------*\
|---------------------- Posts Setup ---------------------|
\*------------------------------------------------------*/
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_threadpost.php');

$postdm = new vB_DataManager_Post($vbulletin, ERRTYPE_STANDARD);

$postthreadid = $insert['threadid'];
//$postusername = $c['submit_name'];
// Use $postusername if posting as a guest, use $postuserid if posting as a user
$postuserid = $c['submit'];
$postpagetext = $c['message'];
$dateline = $c['time'];

$threadinfo = fetch_threadinfo($postthreadid);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);

$postdm->set_info('forum', $foruminfo);
$postdm->set_info('thread', $threadinfo);
$postdm->set('threadid', $postthreadid);
//$postdm->set('username', $postusername);
// Use $postusername if posting as a guest, use $postuserid if posting as a user
$postdm->set('userid', $postuserid);
$postdm->set('pagetext', $postpagetext);
$postdm->set('allowsmilie', 1);
$postdm->set('visible', 1);
$postdm->set('dateline', $dateline);
$postdm->save();
unset($postdm);
/*------------------------------------------------------*\
|---------------------- Posts Setup ---------------------|
\*------------------------------------------------------*/
}

What should I do with threadmaking and postmaking?

calorie
02 Jan 2008, 11:37
Try either setting vBulletin Options -> Message Posting and Editing Options -> Minimum Time Between Posts to zero or using the following in your script:

$vbulletin->options['floodchecktime'] = 0;

ralle89
02 Jan 2008, 13:09
Thank you very much! that fixed it!