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

XF 1.2 Importing Polls

Valhalla

Well-known member
#1
I get the error below when trying to import polls stage using the MyBB importer.

It may or may not be related to this: http://xenforo.com/community/threads/duplicate-entry-error.29424

Server Error
Mysqli statement execute error : Duplicate entry 'thread-762130' for key 'content_type_content_id'

  1. Zend_Db_Statement_Mysqli->_execute() in \library\Zend\Db\Statement.php at line 297
  2. Zend_Db_Statement->execute() in \library\Zend\Db\Adapter\Abstract.php at line 479
  3. Zend_Db_Adapter_Abstract->query() in \library\Zend\Db\Adapter\Abstract.php at line 574
  4. Zend_Db_Adapter_Abstract->insert() in \library\XenForo\DataWriter.php at line 1612
  5. XenForo_DataWriter->_insert() in \library\XenForo\DataWriter.php at line 1601
  6. XenForo_DataWriter->_save() in \library\XenForo\DataWriter.php at line 1393
  7. XenForo_DataWriter->save() in \library\XenForo\Model\Import.php at line 599
  8. XenForo_Model_Import->_importData() in \library\XenForo\Model\Import.php at line 1769
  9. XenForo_Model_Import->importThreadPoll() in \library\XenForo\Importer\MyBb.php at line 1773
  10. XenForo_Importer_MyBb->stepPolls() in \library\XenForo\Importer\Abstract.php at line 97
  11. XenForo_Importer_Abstract->runStep() in \library\XenForo\ControllerAdmin\Import.php at line 187
  12. XenForo_ControllerAdmin_Import->_runStep() in \library\XenForo\ControllerAdmin\Import.php at line 135
  13. XenForo_ControllerAdmin_Import->actionImport() in \library\XenForo\FrontController.php at line 347
  14. XenForo_FrontController->dispatch() in \library\XenForo\FrontController.php at line 134
  15. XenForo_FrontController->run() in \admin.php at line 13
 

Jake Bunce

XenForo moderator
Staff member
#4
Does MyBB allow that? If so then the importer should be changed to account for that. If not then it's a problem with your MyBB data which needs to be manually fixed in the database before running the import again.
 

Valhalla

Well-known member
#5
Does MyBB allow that? If so then the importer should be changed to account for that. If not then it's a problem with your MyBB data which needs to be manually fixed in the database before running the import again.
Should have said, no MyBB doesn't allow that as standard. It is definitely something unique to my database.

I deleted the duplicate entry, and the import completed successfully after that.
 

Valhalla

Well-known member
#6
I'm looking for some advice, and I should say this is unique to me and not the MyBB importer.

Poll options are delimited by a set of unique characters, but because of the way the poll entries are included in my database, the final option has a delimiter after it. An example is this: "Yes||~|~||No||~|~||Maybe||~|~||". This creates a problem when using the importer because it creates an empty poll option.

Basically, I need to modify the importer to remove empty values when exploding a string. How can I alter the following line (or otherwise) to do this?

PHP:
$responses = explode('||~|~||', $this->_convertToUtf8($poll['options'], true));