I am trying to migrate my IPS system over to myBB. The IPS system just costs too much money to run and I'm more found of an opensource system anyways. I am trying to run the merge script at: https://www.clanlod.net/newsite/merge/index.php but keep gettting this error when I get down to the forums script: MyBB SQL Error
MyBB has experienced an internal SQL error and cannot continue.
SQL Error:
1366 - Incorrect integer value: '' for column 'pid' at row 1
Query:
UPDATE mybb_forums SET `pid`='', `parentlist`='45' WHERE fid='45' LIMIT 1.
I've read that it is due to MySQL strict mode being enabled and know that I can't change this myself. Does anyone know a work around for getting this merge script to work? This is the actual merge script I am using: https://mybb.com/download/merge-system/
IPS to myBB Conversion
-
- A semi-regular
- Posts: 26
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Fri Jun 24, 2011 10:40 pm
Re: IPS to myBB Conversion
I'm not familiar with your import process specifically, but it seems that MyBB set up the database to require that the "pid" value be an integer. Your import script doesn't seem to be handling that properly. It could be that it should be setting it to NULL instead of '', or that the pid should be set to an actual number (such as one that matches the fid field).
-
- A semi-regular
- Posts: 26
- Joined: Fri Jun 24, 2011 10:40 pm
Re: IPS to myBB Conversion
Code: Select all
<?php
/**
* MyBB 1.8 Merge System
* Copyright 2014 MyBB Group, All Rights Reserved
*
* Website: http://www.mybb.com
* License: http://www.mybb.com/download/merge-system/license/
*/
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
/** @property IPB4_Converter $board */
class IPB4_Converter_Module_Forums extends Converter_Module_Forums {
var $settings = array(
'friendly_name' => 'forums',
'progress_column' => 'id',
'default_per_screen' => 1000,
);
function import()
{
global $import_session, $db;
$query = $this->old_db->simple_select("forums_forums", "*", "", array('order_by' => 'parent_id', 'order_dir' => 'asc', 'limit_start' => $this->trackers['start_forums'], 'limit' => $import_session['forums_per_screen']));
while($forum = $this->old_db->fetch_array($query))
{
$fid = $this->insert($forum);
// Update parent list.
if($forum['parent_id'] == '-1')
{
$db->update_query("forums", array('parentlist' => $fid), "fid = '{$fid}'");
}
}
}
function convert_data($data)
{
$insert_data = array();
// Invision Power Board 4 values
$insert_data['import_fid'] = $data['id'];
$insert_data['name'] = $this->board->getLanguageString("forums_forum_{$data['id']}", 'forums');
$desc = $this->board->getLanguageString("forums_forum_{$data['id']}_desc", 'forums');
if($desc != "forums_forum_{$data['id']}_desc")
{
$insert_data['description'] = $desc;
}
$insert_data['disporder'] = $data['position'];
$insert_data['password'] = $data['password'];
if($data['sort_key'] == 'last_post')
{
$data['sort_key'] = '';
}
$insert_data['defaultsortby'] = $data['sort_key'];
// We have a category
if($data['parent_id'] == '-1')
{
$insert_data['type'] = 'c';
$insert_data['import_fid'] = $data['id'];
}
// We have a forum
else
{
$insert_data['linkto'] = $data['redirect_url'];
$insert_data['type'] = 'f';
$insert_data['import_pid'] = $data['parent_id'];
}
$insert_data['import_fid'] = $data['id'];
return $insert_data;
}
function fetch_total()
{
global $import_session;
// Get number of forums
if(!isset($import_session['total_forums']))
{
$query = $this->old_db->simple_select("forums_forums", "COUNT(*) as count");
$import_session['total_forums'] = $this->old_db->fetch_field($query, 'count');
$this->old_db->free_result($query);
}
return $import_session['total_forums'];
}
/**
* Correctly associate any forums with their correct parent ids. This is automagically run after importing
* forums.
*/
function cleanup()
{
global $db;
$query = $db->query("
SELECT f.fid, f2.fid as updatefid, f.import_fid
FROM ".TABLE_PREFIX."forums f
LEFT JOIN ".TABLE_PREFIX."forums f2 ON (f2.import_fid=f.import_pid)
WHERE f.import_pid != '0' AND f.pid = '0'
");
while($forum = $db->fetch_array($query))
{
$db->update_query("forums", array('pid' => $forum['updatefid'], 'parentlist' => make_parent_list($forum['import_fid'])), "fid='{$forum['fid']}'", 1);
}
parent::cleanup();
}
}
-
- A semi-regular
- Posts: 26
- Joined: Fri Jun 24, 2011 10:40 pm
Re: IPS to myBB Conversion
It looks like in my database it successfully merged all the forums but failed to assign the correct pid's to about 25% of them. Which led to the forums not being displayed and it throwing the error. I went in and manually assigned the pid's myself and it seems to have tricked the merge system into thinking that it completed the merge on the forums. So it seems that I was able to transfer everything over, save for some avatars...no big deal, over to the myBB system.