• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed vB 3.8 importer: import custom user fields

mlx

Well-known member
#1
The importer is supposed to be able to import data from more than one source vBulletin, right?

Our forums share some common custom user fields.

Trying to import data from the 2nd forum fails with:

Server Error

Mysqli statement execute error : Duplicate entry 'postbit_template_selectio' for key 'PRIMARY'
I guess I can work around this by editing the source database. Just thought I'd post this here anyway.
 

mlx

Well-known member
#3
Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Duplicate entry 'postbit_template_selectio' for key 'PRIMARY' - library/Zend/Db/Statement/Mysqli.php:214
Generated By: admin, Today at 10:00 AM

Stack Trace
#0 /home/domaincom/xenforo/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/domaincom/xenforo/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/domaincom/xenforo/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xf...', Array)
#3 /home/domaincom/xenforo/library/XenForo/DataWriter.php(1591): Zend_Db_Adapter_Abstract->insert('xf_user_field', Array)
#4 /home/domaincom/xenforo/library/XenForo/DataWriter.php(1580): XenForo_DataWriter->_insert()
#5 /home/domaincom/xenforo/library/XenForo/DataWriter.php(1381): XenForo_DataWriter->_save()
#6 /home/domaincom/xenforo/library/XenForo/Model/Import.php(658): XenForo_DataWriter->save()
#7 /home/domaincom/xenforo/library/XenForo/Importer/vBulletin.php(635): XenForo_Model_Import->importUserField(10, Array)
#8 /home/domaincom/xenforo/library/XenForo/Importer/Abstract.php(77): XenForo_Importer_vBulletin->stepUserFields(0, Array)
#9 /home/domaincom/xenforo/library/XenForo/ControllerAdmin/Import.php(180): XenForo_Importer_Abstract->runStep(Object(XenForo_ControllerAdmin_Import), Object(XenForo_ImportSession), 'userFields', 0, Array)
#10 /home/domaincom/xenforo/library/XenForo/ControllerAdmin/Import.php(232): XenForo_ControllerAdmin_Import->_runStep(Object(XenForo_Importer_vBulletin), Object(XenForo_ImportSession), 'userFields', 0, Array)
#11 /home/domaincom/xenforo/library/XenForo/ControllerAdmin/Import.php(175): XenForo_ControllerAdmin_Import->_startStep(Object(XenForo_Importer_vBulletin), Object(XenForo_ImportSession), 'userFields', Array)
#12 /home/domaincom/xenforo/library/XenForo/FrontController.php(310): XenForo_ControllerAdmin_Import->actionStartStep()
#13 /home/domaincom/xenforo/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#14 /home/domaincom/xenforo/admin.php(13): XenForo_FrontController->run()
#15 {main}

Request State
array(3) {
["url"] => string(55) "http://xenforo.domain.com/admin.php?import/start-step"
["_GET"] => array(1) {
["import/start-step"] => string(0) ""
}
["_POST"] => array(2) {
["step_userFields"] => string(25) "Import Custom User Fields"
["_xfToken"] => string(53) "1,1324548003,44068217ddb6694106c1a2468ba878015d3dfdd6"
}
}
I guess getUniqueFieldId() isn't really doing what it's supposed to do. Or at least it isn't looking for existing XF fields.

As this is just us playing around on a dev server, not doing a real live import, I helped myself for now by prefixing the fields of the 2nd forum.
 

Mike

XenForo developer
Staff member
#4
I believe this is because the field wasn't truncated to the maximum length before testing if it already existed (and thus didn't match the field, though the truncated version did). So fixed now.