Jake Bunce
Well-known member
Hi,
I have a general issue / question on the Big Board Importer script.
The Export.php not only uses the source database but also the target database ($this->db).
What I don't understand is this for example:
PHP:$users = $this->db->fetchAll(' SELECT user.*, COALESCE(IF(customavatar.dateline, customavatar.dateline, customprofilepic.dateline), 0) AS avatar_date, COALESCE(IF(customavatar.dateline, customavatar.width, customprofilepic.width), 0) AS avatar_width, COALESCE(IF(customavatar.dateline, customavatar.height, customprofilepic.height), 0) AS avatar_height, LOWER(SUBSTRING(PASSWORD(MD5(CONCAT(user.salt, user.userid))), 2)) AS remember_key, (SELECT COUNT(*) FROM ' . $this->sourceDb . '.' . self::$tablePrefix . 'reputation as reputation INNER JOIN ' . $this->sourceDb . '.' . self::$tablePrefix . 'post as post ON (post.postid = reputation.postid) INNER JOIN ' . $this->sourceDb . '.' . self::$tablePrefix . 'thread as thread ON (thread.threadid = post.threadid) WHERE post.visible = 1 AND thread.visible = 1 AND reputation.userid = user.userid AND (reputation > 0 OR (reason = \'\' AND reputation = 0))) AS like_count FROM ' . $this->sourceDb . '.' . self::$tablePrefix . 'user as user LEFT JOIN ' . $this->sourceDb . '.' . self::$tablePrefix . 'customavatar as customavatar ON (customavatar.userid = user.userid) LEFT JOIN ' . $this->sourceDb . '.' . self::$tablePrefix . 'customprofilepic as customprofilepic ON (customprofilepic.userid = user.userid) ORDER BY user.userid LIMIT ' . ($limit * 10000) .', 10000 ') )
This part of the code tries to access a table customprofile in the xenforo database which of course never exists. How is this supposed to even work?
Furthermore: The script assumes that the target database and the source database both have the same table prefix which also seems to be a bug. The user table in vBulletin is "user" in XenForo it's "xf_user".
Has anyone experienced the same issues? Or am I just misunderstanding the script?
Thanks a lot for hints and comments.
-Fabian-
It's using the XF database connection to access the vB database. The rendered query names the vB database for all of those tables, so it looks something like this:
Code:
SELECT *
FROM vbulletin.user AS user
...
The prefix is only used for vB tables, not XF tables.
The only real possible issue here is that both the vB and XF databases need to be accessible by the same MySQL user to allow for the vB database to be accessed using the XF db connection.