Skip to main content
Topic: [Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x? (Read 1478 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x?

Hello,

What is my best bet for OpenImporter converting phpBB 3.0.8 to ElkArte? The master/development branch at github, or maybe one of the versions attached to messages here?

Is there a preferred version of ElkArte to use with OpenImporter? An older version from around the time OpenImporter was developed?

Would I have more success converting to Simple Machines Forum first and then importing to ElkArte? SMF v2.0.12 seems a popular choice for conversions to SMF.

ElkArte looks great! I'd like to try it out, and hope we can ditch our 10 year old phpbb install that is totally unmaintainable.

Thanks!
ian


Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #1
I would try the current master branch and see how that goes, I don't think the development branch is stable ATM.  https://github.com/OpenImporter/openimporter/archive/master.zip

I would also use elkarte 1.0.x as a start, I have not tested open importer with elk 1.1, it may or may not work.  Easy to upgrade that to 1.1 once the import is done.

If that does not work there maybe an older version in one of the attachments that could work, most of those are pre master branch but are more single point solutions vs the framework version we were going for in the master branch.

You may hit some glitches from the DB simply being 10 years old, but it should work.
Squish squish. squish, squish, squish.
Find a bug,
Make a wish.

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #2
Thank you so much for the recommendation. I had been trying with a more recent version of ElkArte, however I'm still having an issue I've been trying to debug. Please let me know if I should start a new thread instead.

Quote
Sorry, the database connection information used in the specified installation of your forum cannot access the installation of phpBB3. This may either mean that the installation doesn't exist, or that the MySQL account used does not have permissions to access it.

The error MySQL gave was: Incorrect database name '''
error_line 351
error_file /var/apps/convert/OpenImporter/Importer.php

I've received this error on both my local development server, and when running on the production server.

Code: [Select]
protected function testTable()
{

if ($_REQUEST['start'] == 0 && empty($_GET['substep']) && ($_GET['step'] == 1 || $_GET['step'] == 2))
{
$query='
SELECT COUNT(*)
FROM ' . $this->config->from_prefix . $this->config->source->getTableTest();


$result = $this->db->query($query, true);
echo $query;//die();

if ($result === false)
throw new \Exception($this->lng->get(array('permission_denied', $this->db->getLastError(), (string) $this->xml->general->name)));

$this->db->free_result($result);
}
}
It's happening here in test table. 
Quote
SELECT COUNT(*) FROM ``.users
This is the query that is formed. I'm guessing the database name goes in there at ``, but I've never used a SQL connection that isn't associated with a single database. I'm embarrassed to say I didn't know it was possible outside the MYSQL command line :)
Code: [Select]
	protected function init_db()
{
try
{
list ($db_server, $db_user, $db_passwd, $db_persist, $db_prefix, $db_name) = $this->config->destination->dbConnectionData();
print_r($this->config->destination->dbConnectionData());

$this->db = new Database($db_server, $db_user, $db_passwd, $db_persist);
Further down in init_db is getting the database settings. I dumped them just to check what we're getting.
Quote
Array ( [0] => localhost [1] => dp_forum [2] => 12345 [3] => [4] => elkarte_ [5] => dp_forum )
All of this is correct for my development box.
Code: [Select]
		if (strpos($db_prefix, '.') === false)
{
// @todo ???
if (is_numeric(substr($db_prefix, 0, 1)))
$this->config->to_prefix = $db_name . '.' . $db_prefix;
else
$this->config->to_prefix = '`' . $db_name . '`.' . $db_prefix;
}
else
{
$this->config->to_prefix = $db_prefix;
}

$this->config->from_prefix = $this->config->source->getPrefix();

if (preg_match('~^`[^`]+`.\d~', $this->config->from_prefix) != 0)
{
$this->config->from_prefix = strtr($this->config->from_prefix, array('`' => ''));
}
Further down in init_db() there's some handling of the to/from_prefix. I don't quite get what it does. Let's see what happens if I force the database name.

Code: [Select]
			$query='
SELECT COUNT(*)
FROM dp_forum.users'; //. $this->config->from_prefix . $this->config->source->getTableTest();

Quote
Message: Undefined variable: current
Trace: Undefined variable: current
Line: 521
File: C:\laragon\www\importer\OpenImporter\Importer.php
Message: Undefined variable: current
Trace: Undefined variable: current
Line: 523
File: C:\laragon\www\importer\OpenImporter\Importer.php
Lots of these in a loop.
Quote
Unsuccessful!
This query:

    SHOW TABLES
    FROM ``
    LIKE 'users';

Caused the error:

    Incorrect database name ''

Line: 117
File: C:\laragon\www\importer\OpenImporter\Database.php
Getting closer I think. The database name is being wiped out somewhere. I will poke around some more and see if I can just force the correct names for my install and move forward.

Thank you again for getting me started.

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #3
Code: [Select]
$this->config->to_prefix ='`dp_forum`.elkarte_';
$this->config->from_prefix='`dp_forum`.phpbb_';
I added these two lines in importer.php around line 415 to force the correct to/from prefixes.

Code: [Select]
		return 'dp_forum';
In phpbb3_importer.php in getDbName() I needed to force the correct db name.

With these hacks I got the conversion started.

I first used v1.0.1. There's a query error about missing 'location' field in user table, so I added it as text type and the conversion completed. Messages and structure imported ok, but only two attachments/files were imported. All private messages are stuck in a single message that pegs the server when loaded. Every message says "Edited by guest at 00:00 Jan 1, 1970" (unix epoch, missing value?). These are the exact same issues I had importing into SMF, and are discussed at length in a thread there with various fixes.

I just completed a conversion to v1.0.10 and have the same issues.

I wouldn't mind nuking everyone's PMs. I do need to poke around the attachments and see whats going on.

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #4
I really didn't want to do a deep dive, but I love this forum and want to try it out that much.

In phpbb3_importer.xml there simply isn't anything to transfer attachments. I see it in the SMF importer though. I tried to update openimporter to transfer the attachments, but I decided spaghetti code is probably the proper answer at this point.

I pulled all the steps from phpbb3_importer.xml, cross checked with phpbb3_to_smf.sql to see what steps are missing, and then I'm updating everything based on this post in the SMF converter forum.

I will upload my final script to help anyone else wanting to try ElkArte.

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #5
I've seen "issues" with older DB's before, often times when they have been upgraded over time they get some, lets say unique features, that are handled in the original software but the importers have trouble.  When I've worked  this  in the past I've generally only had access to a "fresh" install db, so I install forum xyz, make some posts / attachments / etc and then use that simple DB as the test to import.

I'm not sure whats going on with the db access, sounds like you don't have a prefix at all in use so the software is not handling that condition correctly.

The other issues are hard to fix without a copy of the db.  If you want to provide me one I'll see what I can do to get it to import but I understand if you are not comfortable with that as well.   You can PM me with a location to fetch a copy if you feel up to it.  If not seems like you are on a good track to at least make progress and I want to incorporate what you learn back into the importer.
Squish squish. squish, squish, squish.
Find a bug,
Make a wish.

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #6
Quote
Sorry, the database connection information used in the specified installation of your forum cannot access the installation of phpBB3. This may either mean that the installation doesn't exist, or that the MySQL account used does not have permissions to access it.

The error MySQL gave was: Incorrect database name '''
error_line 351
error_file /var/apps/convert/OpenImporter/Importer.php

@ian Did you give elkarte database user the required access to use  phpbb3.

ex: Elkuser, ElkDb
phpbbuser, phpDb

phpbbuser should have access to ElkDb and Elkuser should have access to phpDb (second one is not required i believe)

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #7
same db, same user. i will upload a garbage conversion script tomorrow and go back under my bridge :P its almost done. the conversion feels like it should, 2014 php code. it aches to look at it :P i know, i wrote so much myself :P

Re: Best git branch/forum attachment for phpBB 3.0.8 -> ElkArte conversion?

Reply #8
I hacked OpenImporter and this is the carcass that remains... Its just a class full of functions that convert various stuff. My phpBB3.0.8 forum converted perfectly (?) to ElkArte 1.0.10.

Now that I'm familiar with OpenImporter and the SMF Convert scripts, I think these changes could all be put into the open importer xml, but I didn't do it that way. I think for my situation (8 year old phpbb3 desperate to migrate, there's gotta be tons of us) it was best to use something that is straight forward and easily tailored to the individual install.

The OpenImporter phpBB3 XML lacks a bunch of stuff that is in the SMF convert SQL. The SMF convert SQL (master and development) lacks really crucial updates to be at all usable. This package includes every update I could find on the web, as well as a bunch of stuff I noticed (subforum handling is a disaster in everyone's scripts! Only slightly less so in mine!).

This has no interface. Just edit the values in Importer.php and run import.php. I suggest commenting out every step and doing them one at a time. I ran it from my web browser on a laptop with a fairly large forum and gigs of attachments, but I'll probably run it from CLI when I do the live server.

There's no problem with running the conversion multiple times, or even partially. It totally clears out the tables used before each step, and the steps are not interdependent on each other for the most part.

Prevent multiple copies of attachments: delete the attachments, pm_attachments, and avatars (probably in attachments...) before running import_members() or import_attachments() a second time. The files have a unique hash so a new set of files is imported each time. If you don't clean these folders you'll end up with multiple copies and no way to tell which is which without writing some code... However, you can clear the folders and then run import_members() (clears the attachments table and adds the avatars) followed by import_attachments() to import again.


import_boards function
: Beware when importing subforums. The script does the top boards and first layer of sub-boards only. Boards 2 levels deep and lower will go into a new "MANUALLY SORT ME" category so you can fix them yourself.

$my_member_name='';:  Enter your member name here to reset your password to 12345 after the member update. This makes testing much easier because you don't need to do the password reset after each run.

import_attachments: phpBB3 has Private Message attachments but SMF (& ElkArte?) do not. Post attachments go in the attachment table. PM attachments go into a NEW table that the script creates (pm_attachments). Supposedly this can be used by a SMF attachments in PM mod... $pm=true will import PM attachments

Empty things cause errors: Every function BUT import_attachments() probably will cough up blood if there are no records (empty query) for that table in the forum.

Code: [Select]
		$query="SELECT
SUBSTRING(CONCAT('phpBB ', rank_title), 1, 255) AS group_name,
rank_image AS icons, '' AS description, IF(rank_special = 0, rank_min, -1) AS min_posts,
'' AS online_color
FROM {$from_prefix}ranks
ORDER BY rank_min;"; //NOTE: rank_image AS stars for SMF, icons for elkarte

SMF compatible almost: The only difference with simple machines forum that I could find was importing ranks where phpBB's 'rank_image' is used AS 'stars' for SMF, but 'icons' for elkarte. If you changed that I believe this would also export to SMF.

Thanks so much for your help and work on both of these projects. I look forward to trying ElkArte. I hope this also helps others stuck with old, unmaintainable phpBBs.

Re: [Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x?

Reply #9
Oh, wanted to add... This converter does not depend on a working install of either forum, per se. No forum files are included, everything is set manually in the Importer.php process() function. However, avatar paths, avatar salts, upload paths, attachment paths are all pulled from the database of both forums, so things need to at least be at the locations indicated if you care about importing files.

This solves a lot of my issues because it feels like the converters are being too cute when trying to find the prefix and dB names and stuff.

Re: [Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x?

Reply #10
Very glad you go it worked out ... I'm going to look this over and see what I can add back into open importer as time permits.  Right now I want to spend more time on Elk 2.0 :)
Squish squish. squish, squish, squish.
Find a bug,
Make a wish.

Re: [Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x?

Reply #11
Concentrate on ElkArte. I'll put this in git eventually and others can push updates there. I think for big forum moderators with software this old an automated convert is really making things much more difficult than they need to be.  I mean if we use ElkArte we'll plan to stick with current version for 8 years or so. If we can update, great, but nothing is worse than being stuck with phpBB full of hand mod hacks that can never be upgraded.  It's a super nice idea though and I totally get it.

Re: [Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x?

Reply #12
I noticed a little issue doing my final migration right now. After installing the fresh ElkArte be sure and visit the new site once. It seems to update the format of several settings in the database on the first load. Without doing that, the importer choked.

 

Re: [Solved w/script] Best bet for phpBB 3.0.x -> ElkArte 1.0.x?

Reply #13
Extra tip: to redirect to at least the same topic create a viewtopic.php in the root of elkarte with the following redirect code:

Code: [Select]
<?php

$r='http://{yoursite_url}/index.php?topic='.$_GET['t'].'.0';

header('Location: '.$r);
die();

?>

And in viewforum.php:

Code: [Select]
<?php

$r='http://{your site url}/index.php?board='.$_GET['f'].'.0';

header('Location: '.$r);
die();

?>

Be sure to replace {yoursite_url} with your actual forum address.