News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

phpbb3.2 to SMF 2.0.15

Started by numand, April 01, 2018, 12:19:50 PM

Previous topic - Next topic

numand

Hi,

I am trying to convert a phpbb3.2 forum to a SMF 1.0.15 forum. When I run the convert script[1], it prints this error:


/usr/bin/php7.0 -f convert.php -- --path_to=/var/www/smf --path_from=/var/www/phpbb --db_pass=nnn --convert_script=phpbb3_to_smf.sql

Starting Conversion

* Converting ranks...
PHP Notice:  Undefined property: mysqli_result::$EOF in /var/www/smf/convert.php on line 2721
PHP Notice:  Undefined property: mysqli_result::$Fields in /var/www/smf/convert.php on line 2725
PHP Notice:  Trying to get property of non-object in /var/www/smf/convert.php on line 2726
PHP Fatal error:  Uncaught Error: Call to undefined method mysqli_result::MoveNext() in /var/www/smf/convert.php:2731
Stack trace:
#0 /var/www/smf/convert.php(1251): convert_fetch_assoc(Object(mysqli_result))
#1 /var/www/smf/convert.php(3038): doStep1()
#2 /var/www/smf/convert.php(31): cmdStep0()
#3 {main}
  thrown in /var/www/smf/convert.php on line 2731


Mentioned error lien (2721, 2725 and 2726) are in this function:

function convert_fetch_assoc($result)
{
global $smcFunc;

// Okay, the hardest is ADO (Windows only, by the way.)
if (!is_resource($result) && is_object($result))
{
if ($result->EOF) //-------> 2721
return false;

$row = array();
$fields = $result->Fields; //----------> 2725
for ($i = 0, $n = $fields->Count; $i < $n; $i++) //---------> 2726
{
$field = $fields[$i];
$row[$field->Name] = $field->Value;
}
$result->MoveNext(); //-------------> 2731

return $row;
}

$type = get_resource_type($result);
if ($type == 'odbc result')
return odbc_fetch_array($result);
else
return $smcFunc['db_fetch_assoc']($result);
}


But $result->MoveNext(); statement is not only in this function but in lots of functions.

Could you help me to solve this problem?

SMF Version: 2.0.15
phpbb Version: 3.2
PHP Version:

php --version
PHP 7.0.28-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.28-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies


MariaDB Version:

mysql --version
mysql  Ver 14.14 Distrib 5.7.21, for Linux (x86_64) using  EditLine wrapper


Operation System: Ubuntu 16.04.4

digger


numand

@digger,

Are you suggesting that first install SMF 1.0.13 and then run convert script?

digger

Quote from: numand on April 01, 2018, 12:52:12 PM
@digger,

Are you suggesting that first install SMF 1.0.13 and then run convert script?
Yes

Illori

SMF 1.0 or SMF 1.1.* does not support php 7.* you might not have a lot of luck getting it to work.

digger

Quote from: numand on April 01, 2018, 12:52:12 PM
@digger,

Are you suggesting that first install SMF 1.0.13 and then run convert script?
I mean 2.0.13. Sorry.

numand

Quote from: digger on April 01, 2018, 02:08:36 PM
Quote from: numand on April 01, 2018, 12:52:12 PM
@digger,

Are you suggesting that first install SMF 1.0.13 and then run convert script?
I mean 2.0.13. Sorry.

Thank you for advise @digger but I got the same error. This is from SMF 2.0.13:

/usr/bin/php7.0 -f convert.php -- --path_to=/var/www/smf --path_from=/var/www/phpbb --db_pass=nnn --convert_script=phpbb3_to_smf.sql

Starting Conversion

* Converting ranks...
PHP Notice:  Undefined property: mysqli_result::$EOF in /var/www/smf/convert.php on line 2721
PHP Notice:  Undefined property: mysqli_result::$Fields in /var/www/smf/convert.php on line 2725
PHP Notice:  Trying to get property of non-object in /var/www/smf/convert.php on line 2726
PHP Fatal error:  Uncaught Error: Call to undefined method mysqli_result::MoveNext() in /var/www/smf/convert.php:2731
Stack trace:
#0 /var/www/smf/convert.php(1251): convert_fetch_assoc(Object(mysqli_result))
#1 /var/www/smf/convert.php(3038): doStep1()
#2 /var/www/smf/convert.php(31): cmdStep0()
#3 {main}
  thrown in /var/www/smf/convert.php on line 2731
[code]

digger

Did you try to downgrade php version?
Some time ago I converted old phpBB forum and encountered the same error, but successfully converted to SMF 2.0.13 with php 5.4 finally.

numand

@digger,

No, I did not try to downgrade PHP version to 5.4. According to this[1] answer, the minimum version of PHP that can be installed is 5.6. I will try this in my local computer in order to not to mess server.

[1] hxxp:askubuntu.com/questions/109404/how-do-i-install-different-upgrade-or-downgrade-php-version-in-still-supported [nonactive]

digger

Quote from: numand on April 06, 2018, 03:40:57 PM
@digger,

No, I did not try to downgrade PHP version to 5.4. According to this[1] answer, the minimum version of PHP that can be installed is 5.6. I will try this in my local computer in order to not to mess server.

[1] https://askubuntu.com/questions/109404/how-do-i-install-different-upgrade-or-downgrade-php-version-in-still-supported
You can try with php 5.6. I think this converter needs php version with old mysql extension support and smf version without php 7.0 support.

numand

@digger,

As you said, PHP 5.6 with old MySQL/MariaDB extension partially works. Even so the converter did not do its job completely.

This is what I did so far:
1. Comment out functions that contains SQL_MAX_JOIN_SIZE in convert.php

diff -u original_convert.php changed_convert.php
// Attempt to allow big selects, only for mysql so far though.
- if ($smcFunc['db_title'] == 'MySQL')
- {
- $results = $smcFunc['db_query']('', "SELECT @@SQL_BIG_SELECTS, @@SQL_MAX_JOIN_SIZE", 'security_override');
- list($big_selects, $sql_max_join) = $smcFunc['db_fetch_row']($results);
+ //if ($smcFunc['db_title'] == 'MySQL')
+ //{
+ // $results = $smcFunc['db_query']('', "SELECT @@SQL_BIG_SELECTS, @@SQL_MAX_JOIN_SIZE", 'security_override');
+ // list($big_selects, $sql_max_join) = $smcFunc['db_fetch_row']($results);

// Only waste a query if its worth it.
- if (empty($big_selects) || ($big_selects != 1 && $big_selects != '1'))
- $smcFunc['db_query']('', "SET @@SQL_BIG_SELECTS = 1", 'security_override');
+ // if (empty($big_selects) || ($big_selects != 1 && $big_selects != '1'))
+ // $smcFunc['db_query']('', "SET @@SQL_BIG_SELECTS = 1", 'security_override');

// Lets set MAX_JOIN_SIZE to something we should
- if (empty($sql_max_join) || ($sql_max_join == '18446744073709551615' && $sql_max_join == '18446744073709551615'))
- $smcFunc['db_query']('', "SET @@SQL_MAX_JOIN_SIZE = 18446744073709551615", 'security_override');
- }
+ // if (empty($sql_max_join) || ($sql_max_join == '18446744073709551615' && $sql_max_join == '18446744073709551615'))
+ // $smcFunc['db_query']('', "SET @@SQL_MAX_JOIN_SIZE = 18446744073709551615", 'security_override');
+ //}

// Attempt to allow big selects, only for mysql so far though.
- if ($smcFunc['db_title'] == 'MySQL' && (trim($db_errno) == 1104 || strpos($db_error, 'use SET SQL_BIG_SELECTS=1') !== false))
- {
- $results = $smcFunc['db_query']('', "SELECT @@SQL_BIG_SELECTS, @SQL_MAX_JOIN_SIZE", 'security_override');
- list($big_selects, $sql_max_join) = $smcFunc['db_fetch_row']($results);
+ //if ($smcFunc['db_title'] == 'MySQL' && (trim($db_errno) == 1104 || strpos($db_error, 'use SET SQL_BIG_SELECTS=1') !== false))
+ //{
+ // $results = $smcFunc['db_query']('', "SELECT @@SQL_BIG_SELECTS, @SQL_MAX_JOIN_SIZE", 'security_override');
+ // list($big_selects, $sql_max_join) = $smcFunc['db_fetch_row']($results);

// Only waste a query if its worth it.
- if (empty($big_selects) || ($big_selects != 1 && $big_selects != '1'))
- $smcFunc['db_query']('', "SET @@SQL_BIG_SELECTS = 1", 'security_override');
+ // if (empty($big_selects) || ($big_selects != 1 && $big_selects != '1'))
+ // $smcFunc['db_query']('', "SET @@SQL_BIG_SELECTS = 1", 'security_override');

// Lets set MAX_JOIN_SIZE to something we should
- if (empty($sql_max_join) || ($sql_max_join == '18446744073709551615' && sql_max_join == '18446744073709551615'))
- $smcFunc['db_query']('', "SET @@SQL_MAX_JOIN_SIZE = 18446744073709551615", 'security_override');
+ // if (empty($sql_max_join) || ($sql_max_join == '18446744073709551615' && sql_max_join == '18446744073709551615'))
+ // $smcFunc['db_query']('', "SET @@SQL_MAX_JOIN_SIZE = 18446744073709551615", 'security_override');

// Try again.
- $result = $smcFunc['db_query']('', $string, 'security_override');
+ // $result = $smcFunc['db_query']('', $string, 'security_override');

- if ($result !== false)
- return $result;
- }
+ // if ($result !== false)
+ // return $result;
+ //}


2. Remove some parameters(?) form phpbb3_to_smf.sql file

diff -u original_phpbb3_to_smf.sql changed_phpbb3_to_smf.sql
- SUBSTRING(u.user_from, 1, 255) AS location,
+ '' AS location,
- SUBSTRING(u.user_msnm, 1, 255) AS msn,
- SUBSTRING(u.user_aim, 1, 16) AS aim,
- SUBSTRING(u.user_icq, 1, 255) AS icq,
- SUBSTRING(u.user_yim, 1, 32) AS yim,
- SUBSTRING(u.user_website, 1, 255) AS website_title,
- SUBSTRING(u.user_website, 1, 255) AS website_url,
+ '' AS msn,
+ '' AS aim,
+ '' AS icq,
+ '' AS yim,
+ '' AS website_title,
+ '' AS website_url,
- f.forum_id AS id_board, CASE WHEN f.parent_id = c.temp_id THEN 0 ELSE f.parent_id END AS id_parent, f.left_id AS board_order, f.forum_posts AS num_posts,
+ f.forum_id AS id_board, CASE WHEN f.parent_id = c.temp_id THEN 0 ELSE f.parent_id END AS id_parent, f.left_id AS board_order, '' AS num_posts,
- SUBSTRING(f.forum_desc, 1, 65534) AS description, f.forum_topics AS num_topics, f.forum_last_post_id AS id_last_msg
+ SUBSTRING(f.forum_desc, 1, 65534) AS description, '' AS num_topics, f.forum_last_post_id AS id_last_msg


u.user_{msnm, aim, icq, yim, website}, u.user_from is not important but hxxp:f.forum [nonactive]_posts and hxxp:f.forum [nonactive]_topics are important datas. These are errors I get if I do not change phpbb3_to_smf.sql file:

Unsuccessful! Database error message:
Unknown column 'u.user_from' in 'field list'

Unsuccessful! Database error message:
Unknown column 'u.user_msnm' in 'field list' # and friends

* Converting boards...
Unsuccessful! Database error message:
Unknown column 'f.forum_posts' in 'field list

* Converting boards...
Unsuccessful! Database error message:
Unknown column 'f.forum_topics' in 'field list'


And this is whre I am stuck:

Starting Conversion

* Converting ranks...
Successful.

* Converting groups...
Successful.

* Converting members...
Successful.

* Converting additional member groups...
Successful.

* Preparing for categories conversion...
Successful.

* Converting categories...
Successful.

* Converting boards...
Wrong value type sent to the database. Integer expected. (num_posts)

numand

OK, I changed phpbb3_to_smf.sql file according to this[1] post but instead of changing t.topic_replies to t.topic_posts, I changed to t.topic_posts_approved. And converting phpbb3 to SMF ended successfully!

Thank you for your guidance @digger!

[1] https://www.simplemachines.org/community/index.php?topic=557174.msg3948846#msg3948846

vbgamer45

Can you post your final file here.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

numand

@vbgamer45,

I attached both convert.php and phpbb3_to_smf.sql files.
My working environment:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial


php -v
PHP 5.6.35-1+ubuntu16.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies


dpkg -l | grep php5.6
ii  libapache2-mod-php5.6                      5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php5.6                                     5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    all          server-side, HTML-embedded scripting language (metapackage)
ii  php5.6-cli                                 5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        command-line interpreter for the PHP scripting language
ii  php5.6-common                              5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        documentation, examples and common module for PHP
ii  php5.6-fpm                                 5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5.6-json                                5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        JSON module for PHP
ii  php5.6-mysql                               5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        MySQL module for PHP
ii  php5.6-opcache                             5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        Zend OpCache module for PHP
ii  php5.6-readline                            5.6.35-1+ubuntu16.04.1+deb.sury.org+1                    amd64        readline module for PHP


mysql --version
mysql  Ver 15.1 Distrib 10.0.34-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2


nginx -v
nginx version: nginx/1.10.3 (Ubuntu)


server {
listen 80;
listen [::]:80;

root /var/www/smf;

index index.php index.html index.htm;

server_name _;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
}
}

vbgamer45

Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

AOKP

For some reason I cannot get this running with PHP5.6.
Error is the same as in the first post.

GigaWatt

Did you use the attached files from this post?
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

CrimeS

Hello, while converting from phpBB3.2 -> SMF 2.0.19 I noticed that the topics have lots of html in their content:
<B><s>[b]</s><I><s>[i]</s><U><s>[u]</s>Biografia:<e>[/u]</e></U><e>[/i]</e></I><e>[/b]</e></B><br/>

Is this an artefact caused by conversion, or should I be able to get around this?

vbgamer45

It's a known issue at this point. Still working on a fix.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

CrimeS


Advertisement: