Converting from IPB 3.4.6, users amount converted not completely

Converting from other board software? Good decision! Need help? Have a question about a convertor? Wish to offer a convertor package? Post here.
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

My server's environment:
OS: Debian 7.x (Linux ipb 3.2.0-6-amd64)
MySQL: 5.5.60
PHP:5.4.45

phpBB: 3.0.12
IPB: 3.4.6

I read these this topic, and also dicuss here.
After fresh installed phpBB 3.0.12 and converted from IPB 3.4.6, I got no error during the process.

But my remaining issue is:
The phpbb_users only have 780 Rows converted from IPB 3.4.6 ibf_members that have 1725 Rows.
Not whole ipb members Rows converted to phpBB users.

I check my phpBB and ipb database,the name that converted not successfully included Chinese and English name.

And i also disable these codes of functions_ipb34.php.

Code: Select all

	//$drop_sql = 'DROP TABLE ' . USERCONV_TABLE;
	//$db->sql_query($drop_sql);
The phpbb_userconv has 1725 Rows that are all members Rows of IPB 3.4.6.

How to check and edit convertor's code, Please give me a hint.

Thanks.
Last edited by aeolustw on Wed Oct 31, 2018 11:49 pm, edited 1 time in total.
Don't care where the hacker came from, just what it did.
User avatar
Ger
Registered User
Posts: 2116
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by Ger »

To add to this, I wrote earlier:
Ger wrote: Wed Oct 10, 2018 2:48 pmThat's probably due to the function remove_invalid_users() in ./includes/functions_convert.php that's called after the users have been converted.
It basically removes any user that has an empty username_clean. That value is generated after encoding the original IPB username to UTF8, stripping any special characters, lowercasing them, etc. It might be that with Chinese characters, a problem arises.

Since I have no experience with such character and I'm also not very specialised in encoding stuff, you'd better open up a specific support topic to get the attention of more knowledgeable people on this manner. Feel free to refer to this topic and poke me if you need my insight.
As stated, this is beyond my field of expertise and I also think it's a generic conversion issue. There might be a simple solution to this, I'm just unaware of it ;)
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

Hello,

You could also edit the members or users table manually in phpMyAdmin if is the only table that is not converted.
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

@orynider
How to edit?
There are 1725-779=946 that are not converted sucessfully, edit them one by one? :mrgreen:
I don't think it's efficient.
Don't care where the hacker came from, just what it did.
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

Open: includes\functions_user.php or functions.php

Find:

Code: Select all

/**
 * Remove User
 *
 * @param string	$mode		Either 'retain' or 'remove'
 * @param mixed		$user_ids	Either an array of integers or an integer
 * @param bool		$retain_username
 * @return bool
 */
Before Add:

Code: Select all

/**
* Adds an username_clean
* by orynider based on develop/adjust_usernames.php
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array
* @param array $notifications_data The notifications settings for the new user
* @return the new user's ID.
*/
function username_clean_add($user_row = array(), $cp_data = false, $notifications_data = null)
{
	global $db, $phpbb_container;
	global $cache, $config;
	
	$cache = is_object($cache) ? $cache : new cache(false, defined('DEBUG')); //In sessions
	
	print('<p><span style="color: red;"></span></p><i><p>Refreshing the users table!</p></i>');
	
	/* uncomet to remove and add colomn * /
	$db_tools = $phpbb_container->get('dbal.tools');
	$db_tools->sql_column_remove(USERS_TABLE, 'username_clean', false);
	$db_tools->sql_column_add(USERS_TABLE, 'username_clean', array('column_type_sql' => 'varchar(255)', 'null' => 'NOT NULL', 'default' => '', 'after' => 'username'), false);
	/* */
	
	$serch_field = '';
	
	$sql = "SELECT user_id, username
		FROM " . USERS_TABLE . " 
		ORDER BY user_id ASC";
	$result = $db->sql_query($sql);

	$echos = 0;

	$user_row = $user_row ? $user_row : $db->sql_fetchrowset($result);
	$newest_user_id = count($user_row);
	print('<p><span style="color: red;"></span></p><i><p>Users '. $newest_user_id .'</p></i>');
	
	for($i = 0; $i < $newest_user_id; $i++)
	{
		$username_clean = utf8_clean_string($user_row[$i]['username']);
		$user_id = (int) $user_row[$i]['user_id'];
		
		if (empty($username_clean))
		{
			print('<p><span style="color: red;"></span></p><i><p>Username Empty</p></i>');
		}
		
		print('<p><span style="color: red;"></span></p><i><p>Refresh for '. $username_clean .'</p></i>');
		
		$sql = 'UPDATE ' . USERS_TABLE . "
			SET username_clean = '" . $db->sql_escape($username_clean) . "'
			WHERE user_id = " . $user_id;
		$db->sql_query($sql);

		if ($echos > 200)
		{
			echo '<br />' . "\n";
			$echos = 0;
		}

		echo '.';
		$echos++;

		flush();
	}
	
	
	if ($config['last_user_id'] != $newest_user_id)
	{
		set_config('last_user_id', $newest_user_id);
		$cache->destroy('newest_user');
		$newest_user = $cache->obtain_newest_user();
	}
	
	$db->sql_freeresult($result);
	
	print('<p><span style="color: red;"></span></p><i><p>Refresh FINISHED!</p></i>');
}
Open: ucp.php

Find:

Code: Select all

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
After Add:

Code: Select all

username_clean_add();
After login or logout, Replace with:

Code: Select all

//username_clean_add();
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

After add and try , but no works, thanks anyway.

includes\functions_user.php

Code: Select all

		set_config('newest_user_colour', $row['group_colour'], true);
	}

	return $user_id;
}

//Aeolus add and ref from https://www.phpbb.com/community/viewtopic.php?f=561&t=2489111&e=1&view=unread#unread
/**
* Adds an username_clean
* by orynider based on develop/adjust_usernames.php
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array
* @param array $notifications_data The notifications settings for the new user
* @return the new user's ID.
*/
function username_clean_add($user_row = array(), $cp_data = false, $notifications_data = null)
{
	global $db, $phpbb_container;
	global $cache, $config;
	
	$cache = is_object($cache) ? $cache : new cache(false, defined('DEBUG')); //In sessions
	
	print('<p><span style="color: red;"></span></p><i><p>Refreshing the users table!</p></i>');
	
	/* uncomet to remove and add colomn * /
	$db_tools = $phpbb_container->get('dbal.tools');
	$db_tools->sql_column_remove(USERS_TABLE, 'username_clean', false);
	$db_tools->sql_column_add(USERS_TABLE, 'username_clean', array('column_type_sql' => 'varchar(255)', 'null' => 'NOT NULL', 'default' => '', 'after' => 'username'), false);
	/* */
	
	$serch_field = '';
	
	$sql = "SELECT user_id, username
		FROM " . USERS_TABLE . " 
		ORDER BY user_id ASC";
	$result = $db->sql_query($sql);

	$echos = 0;

	$user_row = $user_row ? $user_row : $db->sql_fetchrowset($result);
	$newest_user_id = count($user_row);
	print('<p><span style="color: red;"></span></p><i><p>Users '. $newest_user_id .'</p></i>');
	
	for($i = 0; $i < $newest_user_id; $i++)
	{
		$username_clean = utf8_clean_string($user_row[$i]['username']);
		$user_id = (int) $user_row[$i]['user_id'];
		
		if (empty($username_clean))
		{
			print('<p><span style="color: red;"></span></p><i><p>Username Empty</p></i>');
		}
		
		print('<p><span style="color: red;"></span></p><i><p>Refresh for '. $username_clean .'</p></i>');
		
		$sql = 'UPDATE ' . USERS_TABLE . "
			SET username_clean = '" . $db->sql_escape($username_clean) . "'
			WHERE user_id = " . $user_id;
		$db->sql_query($sql);

		if ($echos > 200)
		{
			echo '<br />' . "\n";
			$echos = 0;
		}

		echo '.';
		$echos++;

		flush();
	}
	
	
	if ($config['last_user_id'] != $newest_user_id)
	{
		set_config('last_user_id', $newest_user_id);
		$cache->destroy('newest_user');
		$newest_user = $cache->obtain_newest_user();
	}
	
	$db->sql_freeresult($result);
	
	print('<p><span style="color: red;"></span></p><i><p>Refresh FINISHED!</p></i>');
}
////////////////////////////////////////////////////////////////////////////////////////////

/**
* Remove User
*/
function user_delete($mode, $user_id, $post_username = false)
{
ucp.php

Code: Select all

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
username_clean_add();
Don't care where the hacker came from, just what it did.
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

OK, doing same at phpBB3

Open: /olympus/includes/functions_user.php

Find:

Code: Select all

/**
 * Remove User
 *
 * @param string	$mode		'retain' or 'remove'
 * @param int		$user_id
 * @param mixed		$post_username
 * @return bool
 */


Add before:

Code: Select all

/**
* Adds an username_clean
*
* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded.
* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array
* @param array $notifications_data The notifications settings for the new user
* @return the new user's ID.
*/
function username_clean_add($user_row = array(), $cp_data = false, $notifications_data = null)
{
	global $db;
	global $cache, $board_config;
	
	$cache = is_object($cache) ? $cache : new cache(false, defined('DEBUG')); //In sessions
	
	print('<p><span style="color: red;"></span></p><i><p>Refreshing the users table!</p></i>');
	
	$serch_field = '';
	
	$sql = "SELECT user_id, username
		FROM " . USERS_TABLE . " 
		ORDER BY user_id ASC";
	$result = $db->sql_query($sql);

	$echos = 0;

	$user_row = $user_row ? $user_row : $db->sql_fetchrowset($result);
	$newest_user_id = count($user_row);
	print('<p><span style="color: red;"></span></p><i><p>Users '. $newest_user_id .'</p></i>');
	
	for($i = 0; $i < $newest_user_id; $i++)
	{
		$username_clean = utf8_clean_string($user_row[$i]['username']);
		$user_id = (int) $user_row[$i]['user_id'];
		
		if (empty($username_clean))
		{
			print('<p><span style="color: red;"></span></p><i><p>Username Empty</p></i>');
		}
		
		print('<p><span style="color: red;"></span></p><i><p>Refresh for '. $username_clean .'</p></i>');
		
		$sql = 'UPDATE ' . USERS_TABLE . "
			SET username_clean = '" . $db->sql_escape($username_clean) . "'
			WHERE user_id = " . $user_id;
		$db->sql_query($sql);

		if ($echos > 200)
		{
			echo '<br />' . "\n";
			$echos = 0;
		}

		echo '.';
		$echos++;

		flush();
	}
	
	$db->sql_freeresult($result);
	
	print('<p><span style="color: red;"></span></p><i><p>Refresh FINISHED!</p></i>');
}


Open: olympus/ucp.php

Code: Select all

 
/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
// Setting a variable to let the style designer know where he is...
Replace with:

Code: Select all

 
/// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
username_clean_add();
// Setting a variable to let the style designer know where he is...
Now we go to: http://localhost/olympus/ucp.php?mode=login
We get:

Code: Select all

Refreshing the users table!

Users 47

Refresh for anonymous
.

Refresh for admin
.

Refresh for adsbot [google]
.

Refresh for alexa [bot]
.

Refresh for alta vista [bot]
.

Refresh for ask jeeves [bot]
.

Refresh for baidu [spider]
.

Refresh for bing [bot]
.

Refresh for exabot [bot]
.

Refresh for fast enterprise [crawler]
.

Refresh for fast webcrawler [crawler]
.

Refresh for francis [bot]
.

Refresh for gigabot [bot]
.

Refresh for google adsense [bot]
.

Refresh for google desktop
.

Refresh for google feedfetcher
.

Refresh for google [bot]
.

Refresh for heise it-markt [crawler]
.

Refresh for heritrix [crawler]
.

Refresh for ibm research [bot]
.

Refresh for iccrawler - icjobs
.

Refresh for ichiro [crawler]
.

Refresh for majestic-12 [bot]
.

Refresh for metager [bot]
.

Refresh for msn newsblogs
.

Refresh for msn [bot]
.

Refresh for msnbot media
.

Refresh for nutch [bot]
.

Refresh for online link [validator]
.

Refresh for psbot [picsearch]
.

Refresh for sensis [crawler]
.

Refresh for seo crawler
.

Refresh for seoma [crawler]
.

Refresh for seosearch [crawler]
.

Refresh for snappy [bot]
.

Refresh for steeler [crawler]
.

Refresh for telekom [bot]
.

Refresh for turnitinbot [bot]
.

Refresh for voyager [bot]
.

Refresh for w3 [sitesearch]
.

Refresh for w3c [linkcheck]
.

Refresh for w3c [validator]
.

Refresh for yacy [bot]
.

Refresh for yahoo mmcrawler [bot]
.

Refresh for yahoo slurp [bot]
.

Refresh for yahoo [bot]
.

Refresh for yahooseeker [bot]
.

Refresh FINISHED!
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4782: Cannot modify header information - headers already sent
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4784: Cannot modify header information - headers already sent
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4785: Cannot modify header information - headers already sent
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4786: Cannot modify header information - headers already sent
Last edited by orynider on Thu Nov 01, 2018 8:59 pm, edited 1 time in total.
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

Thanks for reply.
I did what you edit, still the same.

After convertion,
phpbb_userconv => 1725
phpbb_users => 780

/ucp.php?mode=login
I got

Code: Select all

Refreshing the users table!

Users 780

Refresh for anonymous
...
...
...
Refresh FINISHED!
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4752: Cannot modify header information - headers already sent
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4754: Cannot modify header information - headers already sent
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4755: Cannot modify header information - headers already sent
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4756: Cannot modify header information - headers already sent
Don't care where the hacker came from, just what it did.
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

I do not have IPB 3.4.6 to simulate a conversion.

So, please post Your phpbb_userconv database structure. :|
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

Code: Select all

 	# 	Column 	Type 	Collation 	Attributes 	Null 	Default 	Extra 	Action
	1 	user_id 	mediumint(8) 			No 	None 			Change Change 	Drop Drop 	More Show more actions
	2 	username_clean 	varchar(255) 	utf8_bin 	No 				Change Change 	Drop Drop 	More Show more actions
Thanks.

p.s.
My ucp.php is at
/my_phpbb/ucp.php
not
/my_phpbb/includes/ucp.php
Don't care where the hacker came from, just what it did.
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

This does not tell me why You cant export phpbb_userconv to phpbb_userconv.sql and renaming in notepad++ this to phpbb_users You import it back and have all users converted, or run then at login/logout that function to fix the field for every user.

Can You please post the full structure so that I can compare it with phpbb_users of Olympus or Ascraeus or Rhea, or of any destination branch?

I edited the post above removing /includes before /ucp.php :)
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

The phpbb_userconv table has only two columns.
Thanks.
phpbb3012_urs_conv01.jpg
You do not have the required permissions to view the files attached to this post.
Don't care where the hacker came from, just what it did.
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

Oh, Sorry that I didn't understand You in the first place. Can You post the structure of users table from IPB ?
User avatar
aeolustw
Registered User
Posts: 15
Joined: Thu Apr 05, 2012 6:04 am
Location: Taiwan

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by aeolustw »

It's ok, that's my fault, I am not good at English,
the ipb member structure that's export from phpmyadmin, hope its usefull.
Thanks your kidness.
ibf_members_stru.txt
You do not have the required permissions to view the files attached to this post.
Don't care where the hacker came from, just what it did.
User avatar
orynider
Translator
Posts: 273
Joined: Wed Nov 16, 2005 12:48 pm
Location: Arad, România
Name: Florin-Ciprian Bodin

Re: Converting from IPB 3.4.6, users amount converted not completely

Post by orynider »

I was looking into Credits.txt and see most of the features are under MIT licence and don't see any reason why I`m not allowed to do a test install and simulate a conversion test on localhost, since any licence is for a real live site and not for localhost. :?:

I asked for a old 3.4.x at Invision Community.

So, maybe I take a look at it this week.
Last edited by orynider on Wed Nov 21, 2018 1:45 pm, edited 1 time in total.

Return to “[3.2.x] Convertors”